I am building an MPI C project in Xcode. In order to do run it, I had to:
Specify /path/to/mpiexec in Edit Scheme -> Run -> Info -> Executable, instead of the "default" one, say myprogram if my target is called myprogram.
Specify the following arguments in Edit Scheme -> Run -> Arguments -> Arguments Passed On Launch: -np 4, ${BUILT_PRODUCTS_DIR}/${EXECUTABLE_NAME}
This is clearly analogous to a mpiexec -np 4 a.out command launched on terminal.
The problem is, when I want to debug my application, the execution doesn't "stop" on the breakpoints.
I instantly thought that it is because of the check box Debug Executable in Edit Scheme -> Run -> Info -> Executable. Indeed (as I have just said), the Executable specified in there is mpiexec and not myprogram.
Thus, is there an option or some command I could set in Xcode to attach the lldb to myprogram?
Post
Replies
Boosts
Views
Activity
I am building and running a simple Open MPI C application.
In order to run it, I configured the run process in this way:\
Edit Scheme -> Run -> Info -> Executable -> Other... -> /path/to/mpiexec
Edit Scheme -> Run -> Arguments -> Arguments Passed On Launch -> -np 4 "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_NAME)"
Now, instead of the hardcoded "4" as the number of processes, I want to specify an environment variable (like the already existing BUILT_PRODUCTS_DIR and EXECUTABLE_NAME environment variables), so I enter in Environment Variables NUM_PROCS as Name and 4 as Value.
Thus, I write in Arguments Passed On Launch the whole quoted string:
"-np" "$(NUM_PROCS)" "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_NAME)".
And Xcode can't read the NUM_PROCS environment variable (despite I can easily read it in the C program by a getenv("NUM_PROCS")!), in fact, it runs the default number of processes of my system (12).
I tried in a very large number the different ways of writing arguments (every string on a new line, with quotes, without quotes, ...), but none worked as I expected.
M3 Pro, macOS Sequoia 15.0.1
Xcode 16.0
Even if I've set all for OpenMP in my Xcode project, I can't build and run it without the static OpenMP library.
I wish I could do it with the dynamic library.
Detailed here:
https://stackoverflow.com/questions/79059321/how-to-correctly-link-the-libomp-dynamic-library-in-xcode
Sorry for this, but I'm going to leave you a link of the discussed issue. I wrote the same problem so many times, so it is properly described here.