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

Simple hello world fails to launch correctly #4032

Closed
dmarce1 opened this issue Aug 21, 2019 · 4 comments · Fixed by #4035
Closed

Simple hello world fails to launch correctly #4032

dmarce1 opened this issue Aug 21, 2019 · 4 comments · Fixed by #4035

Comments

@dmarce1
Copy link
Member

dmarce1 commented Aug 21, 2019

Expected Behavior

From this example code:

#include <hpx/hpx_init.hpp>
int hpx_main(int argc, char* argv[]) {
	printf( "Hello World!\n");
	return hpx::finalize();
}
int main(int argc, char* argv[]) {
	hpx::init(argc, argv);
}

I expect there to be one instance of hpx_main called and the output to be:

Hello World!

Actual Behavior

When run with mpirun -np 2, the output is

Hello World!
Hello World!

Steps to Reproduce the Problem

I compiled the above code using cmake file:

project(hello CXX)
find_package(HPX REQUIRED NO_CMAKE_PACKAGE_REGISTRY)

add_hpx_executable(
  hello
  DEPENDENCIES
  SOURCES
    main.cpp
)

and executed it with mpirun -np 2 ./hello

Specifications

... Please describe your environment

  • HPX Version: Top of master
  • Platform (compiler, OS): GNU 8.2 Ubuntu 18.04
@hkaiser
Copy link
Member

hkaiser commented Aug 21, 2019

@dmarce1 Was HPX built with MPI enabled?

@dmarce1
Copy link
Member Author

dmarce1 commented Aug 22, 2019

Yes

@hkaiser
Copy link
Member

hkaiser commented Aug 22, 2019

Please see #4035 for a possible solution and let us know if this fixes your issue.

@dmarce1
Copy link
Member Author

dmarce1 commented Aug 22, 2019

This fixes it. Thanks.

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

Successfully merging a pull request may close this issue.

2 participants