[vtkusers] VTK + openMPI + CMake

Matthias Härtel metty87 at googlemail.com
Mon Nov 26 12:06:49 EST 2012


the cache entries with mpi when i use your cmakelists:

//Executable for running MPI programs.
MPIEXEC:FILEPATH=C:/Program Files (x86)/OpenMPI_v1.6-x64/bin/mpiexec.exe

//Maximum number of processors available to run MPI applications.
MPIEXEC_MAX_NUMPROCS:STRING=2

//Flag used by MPI to specify the number of processes for MPIEXEC;
// the next option will be the number of processes.
MPIEXEC_NUMPROC_FLAG:STRING=-np

//These flags will come after all flags given to MPIEXEC.
MPIEXEC_POSTFLAGS:STRING=

//These flags will be directly before the executable that is being
// run by MPIEXEC.
MPIEXEC_PREFLAGS:STRING=

//Value Computed by CMake
MPI_CMake_BINARY_DIR:STATIC=D:/Programmieren/mpi/bin

//Value Computed by CMake
MPI_CMake_SOURCE_DIR:STATIC=D:/Programmieren/mpi

//MPI compiler. Used only to detect MPI compilation flags.
MPI_COMPILER:FILEPATH=C:/Program Files (x86)/OpenMPI_v1.6-x64/bin/mpic++.exe

//MPI compilation flags
MPI_COMPILE_FLAGS:STRING=

//Extra MPI libraries to link against
MPI_EXTRA_LIBRARY:STRING=MPI_EXTRA_LIBRARY-NOTFOUND

//MPI include path
MPI_INCLUDE_PATH:STRING="C:\Program;Files;(x86)\OpenMPI_v1.6-x64/include"

//MPI library to link against
MPI_LIBRARY:FILEPATH=NOTFOUND

//MPI linking flags
MPI_LINK_FLAGS:STRING=



Am 26.11.2012 17:31, schrieb Kevin H. Hobbs:
> On 11/26/2012 10:52 AM, Matthias Härtel wrote:
>> In Cmake i must set some entries manually: i set MPI_LIBRARY to
> This is all I have in CMakeLists.txt:
>
> 	project( MPI_CMake )
> 	
> 	cmake_minimum_required( VERSION 2.8 )
> 	
> 	find_package( MPI REQUIRED )
> 	
> 	// Fedora puts openMPI and mpich in nonstandard
> 	// places to allow the user to switch.
> 	include_directories( ${MPI_INCLUDE_PATH} )
> 	
> 	add_executable( hello hello.cxx )
> 	target_link_libraries( hello ${MPI_CXX_LIBRARIES} )
>
> and this is hello.cxx
>
> 	#include <stdlib.h>
> 	#include <stdio.h>
> 	#include <mpi.h>
> 	
> 	int main( int argc, char *argv[] )
> 	{
> 	
> 	  int mpi_rank;
> 	  int mpi_size;
> 	
> 	  // Initialise MPI
> 	  MPI_Init( &argc, &argv );
> 	  MPI_Comm_rank( MPI_COMM_WORLD, &mpi_rank );
> 	  MPI_Comm_size( MPI_COMM_WORLD, &mpi_size );
> 	
> 	  printf( "%i of %i\n", mpi_rank, mpi_size );
> 	
> 	  // End MPI
> 	  MPI_Finalize ();
> 	
> 	  return 0;
> 	
> 	}
>
> which works for me with "cmake . && make && mpiexec -n 2 ./hello"
>
> What do you have in CMakeCache.txt if you do not set any variables manually?
>




More information about the vtkusers mailing list