File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed
Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -50,3 +50,10 @@ modules.order
5050Module.symvers
5151Mkfile.old
5252dkms.conf
53+
54+
55+ # CMake
56+ cmake-build-debug /
57+
58+ # IDEA
59+ .idea /
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.13)
2+ project (RandomStringAssembly C)
3+ find_package (MPI REQUIRED)
4+ message (STATUS "Run: ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} EXECUTABLE ${MPIEXEC_POSTFLAGS} ARGS" )
5+
6+ set (CMAKE_C_STANDARD 11)
7+
8+ add_executable (RandomStringAssembly main.c)
9+ target_link_libraries (RandomStringAssembly PUBLIC MPI::MPI_C)
Original file line number Diff line number Diff line change 1+ #include <stdio.h>
2+ #include <mpi.h>
3+
4+ int main (int argc , char * * argv ) {
5+ // Initialize the MPI environment
6+ MPI_Init (NULL , NULL );
7+
8+ // Get the number of processes
9+ int world_size ;
10+ MPI_Comm_size (MPI_COMM_WORLD , & world_size );
11+
12+ // Get the rank of the process
13+ int world_rank ;
14+ MPI_Comm_rank (MPI_COMM_WORLD , & world_rank );
15+
16+ // Get the name of the processor
17+ char processor_name [MPI_MAX_PROCESSOR_NAME ];
18+ int name_len ;
19+ MPI_Get_processor_name (processor_name , & name_len );
20+
21+ // Print off a hello world message
22+ printf ("Hello world from processor %s, rank %d out of %d processors\n" ,
23+ processor_name , world_rank , world_size );
24+
25+ // Finalize the MPI environment.
26+ MPI_Finalize ();
27+ return 0 ;
28+ }
You can’t perform that action at this time.
0 commit comments