On an M3 Pro, in Xcode, I want to run a simple C source file:
#include <mpi.h>
#include <stdio.h>
int main(int argc, char** argv) {
MPI_Init(&argc, &argv);
int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
int world_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
printf("hello from process %d of %d total processes\n", world_rank, world_size);
MPI_Finalize();
return 0;
}
It successfully builds, but it doesn’t run successfully, returning on console:
NSBundle file:///System/Library/PrivateFrameworks/MetalTools.framework/ principal class is nil because all fallbacks have failed
[Mac.station:03539] shmem: mmap: an error occurred while determining whether or not /var/folders/0j/hwf25cd97w1916m2vcbz833r0000gn/T//ompi.Mac.501/jf.0/1294860288/sm_segment.Mac.501.4d2e0000.0 could be created.
hello from process 0 of 1 total processes
Program ended with exit code: 0
What am I missing?
- In order to build, I’ve configured the Xcode project in this way:
- Build Settings -> Header Search Paths =
/opt/homebrew/opt/open-mpi/include
- Build Settings -> Library Search Paths =
/opt/homebrew/opt/open-mpi/lib
- Build Settings -> Other Linker Flags =
-lmpi
(brew --prefix open-mpi
returns /opt/homebrew/opt/open-mpi
)
- The project builds successfully on terminal by executing:
mpicc main.c
and runs successfully by executing:
mpiexec a.out
, showing correctly:hello from process 1...12 of 12 total processes
You need to sign in to view this answers
Leave feedback about this