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

Adds Debug option for hpx initializing from main #3385

Merged
merged 2 commits into from Aug 7, 2018

Conversation

Projects
None yet
2 participants
@NK-Nikunj
Copy link
Contributor

NK-Nikunj commented Jul 17, 2018

Proposed Changes

This PR adds Debug option for hpx initialization after using hpx_main.hpp. Consider the following example:

#include <hpx/hpx_init.hpp>
#include <hpx/hpx_main.hpp>

int hpx_main()
{
  return hpx::finalize();
}

int main()
{
  return hpx::init();
}

Since hpx runtime is already initialized from main, this would result in the following error message:

hpx is already initialized from main.
Note: Delete hpx_main.hpp to initialize hpx system using hpx::init. Exiting...

This is more verbose as compared to previous error message which would explain that hpx::init can't initialize the runtime system.

(defined(__linux) || defined(__linux__) || defined(linux))
// make sure the runtime system is not initialized
// after its activation from int main()
if(get_runtime_ptr() != nullptr &&

This comment has been minimized.

@hkaiser

hkaiser Jul 17, 2018

Member

Do we have to check for get_runtime_ptr() != nullptr twice?

This comment has been minimized.

@NK-Nikunj

NK-Nikunj Jul 18, 2018

Author Contributor

Yes. include_libhpx_wrap will only define whether the route of initialization is through main or not. To know whether hpx has already initialized, we will need the help of get_runtime_ptr(). I'll merge the 2 if statements to make it more clear.

{
// Importing weak symbol from libhpx_wrap.a which may be shadowed by one present in
// hpx_main.hpp.
HPX_SYMBOL_EXPORT __attribute__((weak)) extern bool include_libhpx_wrap;

This comment has been minimized.

@hkaiser

hkaiser Jul 17, 2018

Member

Don't we need the attribute on the definition only?

This comment has been minimized.

@NK-Nikunj

NK-Nikunj Jul 18, 2018

Author Contributor

Yes, we do not need to add attributes twice. I tried to make it clear by adding it twice. I can remove it if you want.

This comment has been minimized.

@hkaiser

hkaiser Jul 18, 2018

Member

@NK-Nikunj I'd say either add it everywhere or just for the definition.

@hkaiser

hkaiser approved these changes Aug 7, 2018

Copy link
Member

hkaiser left a comment

LGTM, thanks!

@hkaiser

This comment has been minimized.

Copy link
Member

hkaiser commented Aug 7, 2018

The test failures are unrelated.

@hkaiser hkaiser merged commit fdc279a into STEllAR-GROUP:master Aug 7, 2018

60 of 62 checks passed

pycicle daint-clang-3.8-boost-1.58.0-c++11-Release Test errors 2
Details
pycicle daint-gcc-7.3.0-boost-1.67.0-c++17-Release Test errors 2
Details
ci/circleci: checkout_code Your tests passed on CircleCI!
Details
ci/circleci: clang_tidy Your tests passed on CircleCI!
Details
ci/circleci: configure Your tests passed on CircleCI!
Details
ci/circleci: core Your tests passed on CircleCI!
Details
ci/circleci: examples Your tests passed on CircleCI!
Details
ci/circleci: inspect Your tests passed on CircleCI!
Details
ci/circleci: install Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.compat Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.components Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.compute Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.config Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.include Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.lcos Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.parallel Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.performance_counters Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.plugins Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.runtime Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.traits Your tests passed on CircleCI!
Details
ci/circleci: tests.headers.util Your tests passed on CircleCI!
Details
ci/circleci: tests.performance Your tests passed on CircleCI!
Details
ci/circleci: tests.regressions Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.actions Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.agas Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.build Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.component Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.computeapi Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.diagnostics Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.lcos Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.parallel.algorithms Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.parallel.block Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.parallel.container_algorithms Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.parallel.datapar_algorithms Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.parallel.executors Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.parallel.segmented_algorithms Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.parcelset Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.performance_counter Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.resource Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.serialization Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.threads Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.traits Your tests passed on CircleCI!
Details
ci/circleci: tests.unit.util Your tests passed on CircleCI!
Details
pycicle daint-3385-clang-6.0.0-Boost-1.65.0-Release Build errors 0
Details
pycicle daint-3385-clang-6.0.0-Boost-1.65.0-Release Config errors 0
Details
pycicle daint-3385-clang-6.0.0-Boost-1.65.0-Release Test errors 0
Details
pycicle daint-3385-gcc-6.2.0-Boost-1.65.0-Release Build errors 0
Details
pycicle daint-3385-gcc-6.2.0-Boost-1.65.0-Release Config errors 0
Details
pycicle daint-3385-gcc-6.2.0-Boost-1.65.0-Release Test errors 0
Details
pycicle daint-clang-3.8-boost-1.58.0-c++11-Release Build errors 0
Details
pycicle daint-clang-3.8-boost-1.58.0-c++11-Release Config errors 0
Details
pycicle daint-gcc-4.9.3-boost-1.58.0-c++11-Debug Build errors 0
Details
pycicle daint-gcc-4.9.3-boost-1.58.0-c++11-Debug Config errors 0
Details
pycicle daint-gcc-4.9.3-boost-1.58.0-c++11-Debug Test errors 0
Details
pycicle daint-gcc-4.9.3-boost-1.58.0-c++11-gcc-4.9.3-boost-1.58.0-c++11-Debug Build errors 0
Details
pycicle daint-gcc-4.9.3-boost-1.58.0-c++11-gcc-4.9.3-boost-1.58.0-c++11-Debug Config errors 0
Details
pycicle daint-gcc-4.9.3-boost-1.58.0-c++11-gcc-4.9.3-boost-1.58.0-c++11-Debug Test errors 0
Details
pycicle daint-gcc-7.3.0-boost-1.67.0-c++17-Release Build errors 0
Details
pycicle daint-gcc-7.3.0-boost-1.67.0-c++17-Release Config errors 0
Details
pycicle daint-gcc-7.3.0-boost-1.67.0-c++17-gcc-7.3.0-boost-1.67.0-c++17-Release Build errors 0
Details
pycicle daint-gcc-7.3.0-boost-1.67.0-c++17-gcc-7.3.0-boost-1.67.0-c++17-Release Config errors 0
Details
pycicle daint-gcc-7.3.0-boost-1.67.0-c++17-gcc-7.3.0-boost-1.67.0-c++17-Release Test errors 0
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.