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