I'm trying to use MPI with the D programming language. D fully supports the C ABI and can link with and call any C code. I've done the obvious stuff and translated the MPI header to D. I then translated a test program from Wikipedia to D. I compiled it with the following command:
dmd test.d -L-lmpistubs
It works when I just run ./test
, and prints:
0: We have 1 processors
However, when I run with mpiexec -n 8 test
, it prints nothing. My understanding is that MPI executables require a bunch of weird linking options, which is why tools like mpicc
exist to automate the process. However, this doesn't help me if I'm trying to use MPI in D. I assume it's because I'm not using the right linker options. Can someone please tell me what mpicc
does and how I can make DMD do the same thing?
Edit: I've found the answer using mpicc -showme
. This shows what commands mpicc
forwards to gcc
. However, I also realized I did the header file translation wrong. Next question: How do to it right.
strace -f mpicc test.c
or something like that, to look for the linker options? I assume it's callingld
or something as a child process. – Gull