Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open MPI in Xcode #8301

Closed
tnorlund opened this issue Dec 18, 2020 · 9 comments
Closed

Open MPI in Xcode #8301

tnorlund opened this issue Dec 18, 2020 · 9 comments
Labels

Comments

@tnorlund
Copy link

I'm having trouble running Open MPI in Xcode. I can execute it just find, but when calling MPI_Init(NULL, NULL);, I get an error: Failed to retrieve device information! Invalid enumerated value!.

Setup

I used Homebrew to install Open MPI. I then used pkg-config to find the libraries, headers, and linker flags required:

% pkg-config --cflags --libs ompi
-I/usr/local/Cellar/open-mpi/4.0.5/include -L/usr/local/Cellar/open-mpi/4.0.5/lib -L/usr/local/opt/libevent/lib -lmpi

From here, I added the header and libraries.

Xcode_MPIPaths

and the linker flags.

Xcode_LinkerFlags

-I/usr/local/Cellar/open-mpi/4.0.5/include \
-L/usr/local/Cellar/open-mpi/4.0.5/lib \
-L/usr/local/opt/libevent/lib \
-lmpi

Finally, I added the executable, orterun, with the correct input arguments.

Xcode_Arguments

Xcode_Schema

I can execute the hello world example fine, but when calling MPI_Init I get some errors. Here is the total output:

2020-12-18 10:19:48.235265-0800 orterun[44036:1914221] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=44036
2020-12-18 10:19:48.235699-0800 orterun[44036:1914221] SecTaskCopyDebugDescription: orterun[44036]/0#-1 LF=0
2020-12-18 10:19:48.284287-0800 orterun[44036:1914221] [CL_INVALID_OPERATION] : OpenCL Error : Failed to retrieve device information! Invalid enumerated value!

2020-12-18 10:19:48.284337-0800 orterun[44036:1914221] [CL_INVALID_OPERATION] : OpenCL Error : Failed to retrieve device information! Invalid enumerated value!

2020-12-18 10:19:48.284362-0800 orterun[44036:1914221] [CL_INVALID_OPERATION] : OpenCL Error : Failed to retrieve device information! Invalid enumerated value!

2020-12-18 10:19:48.284385-0800 orterun[44036:1914221] [CL_INVALID_OPERATION] : OpenCL Error : Failed to retrieve device information! Invalid enumerated value!

2020-12-18 10:19:48.284437-0800 orterun[44036:1914221] [CL_INVALID_OPERATION] : OpenCL Error : Failed to retrieve device information! Invalid enumerated value!

2020-12-18 10:19:48.284474-0800 orterun[44036:1914221] [CL_INVALID_OPERATION] : OpenCL Error : Failed to retrieve device information! Invalid enumerated value!

Hello world from processor Tylers-MacBook-Pro.local, rank 1 out of 4 processors
Hello world from processor Tylers-MacBook-Pro.local, rank 3 out of 4 processors
Hello world from processor Tylers-MacBook-Pro.local, rank 0 out of 4 processors
Hello world from processor Tylers-MacBook-Pro.local, rank 2 out of 4 processors
Program ended with exit code: 0

How do I get rid of the device information warning?

@jsquyres
Copy link
Member

jsquyres commented Jan 3, 2021

Interesting. I can't say I've ever tried to launch Open MPI via XCode.

If I load Open MPI via Homebrew and compile hello_c.c on the command line and run it, I do not get the same warnings you're getting:

# The simple way
$ mpicc hello_c.c -o hello

# The explicit way
$ pkg-config --cflags --libs ompi
-I/usr/local/Cellar/open-mpi/4.0.5/include -L/usr/local/Cellar/open-mpi/4.0.5/lib -L/usr/local/opt/libevent/lib -lmpi
$ gcc -I/usr/local/Cellar/open-mpi/4.0.5/include hello_c.c -c
$ gcc hello_c.o -L/usr/local/Cellar/open-mpi/4.0.5/lib -L/usr/local/opt/libevent/lib -lmpi -o hello_c
$ mpirun -np 2 hello
Hello, world, I am 0 of 2, (Open MPI v4.0.5, package: Open MPI brew@Catalina Distribution, ident: 4.0.5, repo rev: v4.0.5, Aug 26, 2020, 108)
Hello, world, I am 1 of 2, (Open MPI v4.0.5, package: Open MPI brew@Catalina Distribution, ident: 4.0.5, repo rev: v4.0.5, Aug 26, 2020, 108)

(mpirun is a sym link to orterun)

I can't imagine why orterun would be linked against OpenCL...?

@arcticfly
Copy link

@tnorlund what was the resolution?

@deadfffool
Copy link

I wonder it ,too.

@hyoklee
Copy link

hyoklee commented Apr 22, 2023

+1

@tnorlund
Copy link
Author

https://www.tylernorlund.com/blog/using-libraries-with-xcode/

@hyoklee
Copy link

hyoklee commented Apr 22, 2023

Thanks @tnorlund !

Any idea for mpich? I can't select mpirun -> mpiexec.hydra in Xcode.
mpich_mpirun

@williamdavie
Copy link

Dealing with this issue and access to https://www.tylernorlund.com/blog/using-libraries-with-xcode/ is denied. Can someone help?

@jsquyres
Copy link
Member

@hyoklee This github is about Open MPI. I'm afraid we can't answer questions about MPICH -- you'll need to ask them about that. Sorry!

@hyoklee
Copy link

hyoklee commented Jan 22, 2025

@jsquyres OK, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants