CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

How to extract MPI rank?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 9, 2020, 18:05
Default How to extract MPI rank?
  #1
New Member
 
Sicheng Sun
Join Date: Jun 2016
Posts: 8
Rep Power: 6
ssc0109 is on a distinguished road
Hello Friends,
I'm wondering how to extract MPI rank in OpenFOAM?
In general, I think this would work:
Code:
#include"mpi.h"

int main(int argc , char **argv)
{
int size,rank;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);

Info << "rank: " << rank << nl << endl;
}
But I meet the error:
Code:
Fatal error in PMPI_Init_thread: Other MPI error, error stack:
MPI_Init_thread(1028): Cannot call MPI_INIT or MPI_INIT_THREAD more than once
I am using Intel(R) MPI by the way.

Thanks a lot
ssc0109 is offline   Reply With Quote

Old   January 9, 2020, 18:50
Default
  #2
New Member
 
Sicheng Sun
Join Date: Jun 2016
Posts: 8
Rep Power: 6
ssc0109 is on a distinguished road
solved,
for people who meet the same problem,
use
Code:
rank = Pstream::myProcNo();
Pout << "rank: " << rank << nl << endl;
ssc0109 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CentOS kernel update 3.10.0-862.11.6 breaks MPI Michael Rath CFX 0 August 22, 2018 09:10
MPI Application rank 0 exited before MPI_Finalize() with status 1 mustafadeniz89 AVL FIRE 6 November 24, 2015 09:40
Problem running fluent with InfiniBand blackpuma FLUENT 10 August 28, 2011 01:16
Error using LaunderGibsonRSTM on SGI ALTIX 4700 jaswi OpenFOAM 2 April 29, 2008 10:54
Is Testsuite on the way or not lakeat OpenFOAM Installation 6 April 28, 2008 11:12


All times are GMT -4. The time now is 19:02.