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

Fails to build with NVHPC 24.5 #236

Open
fspiga opened this issue May 29, 2024 · 2 comments
Open

Fails to build with NVHPC 24.5 #236

fspiga opened this issue May 29, 2024 · 2 comments

Comments

@fspiga
Copy link

fspiga commented May 29, 2024

Hello,

I am trying to build using NVIDIA C++ Compiler nvc++ version 24.5

CC := nvc++
CFLAGS := -O3 -fomit-frame-pointer -mp -std=c++11

It complains with the following error(s):

nvc++ -O3 -fomit-frame-pointer -mp -std=c++11  -o heterogeneity BioFVM_vector.o BioFVM_mesh.o BioFVM_microenvironment.o BioFVM_solvers.o BioFVM_matlab.o BioFVM_utilities.o BioFVM_basic_agent.o BioFVM_MultiCellDS.o BioFVM_agent_container.o   pugixml.o PhysiCell_phenotype.o PhysiCell_cell_container.o PhysiCell_standard_models.o PhysiCell_cell.o PhysiCell_custom.o PhysiCell_utilities.o PhysiCell_constants.o PhysiCell_basic_signaling.o PhysiCell_signal_behavior.o PhysiCell_rules.o PhysiCell_SVG.o PhysiCell_pathology.o PhysiCell_MultiCellDS.o PhysiCell_various_outputs.o PhysiCell_pugixml.o PhysiCell_settings.o PhysiCell_geometry.o custom.o main.cpp
main.cpp:
/usr/bin/ld: PhysiCell_constants.o: in function `__sti___30___core_PhysiCell_constants_cpp_d2e95040':
nvc++Ormxb4w0R0PHy.ll:(.text+0xb4): undefined reference to `PhysiCell::PhysiCell_constants::advanced_Ki67_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0xc4): undefined reference to `PhysiCell::PhysiCell_constants::advanced_Ki67_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x118): undefined reference to `PhysiCell::PhysiCell_constants::basic_Ki67_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x120): undefined reference to `PhysiCell::PhysiCell_constants::basic_Ki67_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x158): undefined reference to `PhysiCell::PhysiCell_constants::flow_cytometry_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x164): undefined reference to `PhysiCell::PhysiCell_constants::live_cells_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x19c): undefined reference to `PhysiCell::PhysiCell_constants::flow_cytometry_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x1c8): undefined reference to `PhysiCell::PhysiCell_constants::live_cells_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x1f8): undefined reference to `PhysiCell::PhysiCell_constants::flow_cytometry_separated_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x234): undefined reference to `PhysiCell::PhysiCell_constants::flow_cytometry_separated_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x268): undefined reference to `PhysiCell::PhysiCell_constants::cycling_quiescent_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x274): undefined reference to `PhysiCell::PhysiCell_constants::apoptosis_death_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x278): undefined reference to `PhysiCell::PhysiCell_constants::necrosis_death_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x2b4): undefined reference to `PhysiCell::PhysiCell_constants::cycling_quiescent_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x2e0): undefined reference to `PhysiCell::PhysiCell_constants::apoptosis_death_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x30c): undefined reference to `PhysiCell::PhysiCell_constants::advanced_Ki67_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x310): undefined reference to `PhysiCell::PhysiCell_constants::necrosis_death_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x34c): undefined reference to `PhysiCell::PhysiCell_constants::advanced_Ki67_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x370): undefined reference to `PhysiCell::PhysiCell_constants::basic_Ki67_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x378): undefined reference to `PhysiCell::PhysiCell_constants::basic_Ki67_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x3f4): undefined reference to `PhysiCell::PhysiCell_constants::flow_cytometry_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x3f8): undefined reference to `PhysiCell::PhysiCell_constants::flow_cytometry_cycle_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x508): undefined reference to `PhysiCell::PhysiCell_constants::cycling_quiescent_model'
/usr/bin/ld: nvc++Ormxb4w0R0PHy.ll:(.text+0x514): undefined reference to `PhysiCell::PhysiCell_constants::cycling_quiescent_model'
pgacclnk: child process exit status 1: /usr/bin/ld
make: *** [Makefile:71: all] Error 2

I consulted NVIDIA compiler engineer. It looks like the code is not super portable. The file core/PhysiCell_constants.h contains many static data members of type const int, such as:

namespace PhysiCell
{
class PhysiCell_constants
{
 public:
        // ...
        static const int advanced_Ki67_cycle_model= 0;
        // ...
};
};

Each of those static data members must have an out-of-class definition in a .cpp file somewhere, so that storage for the static data member exists somewhere:

namespace PhysiCell {
const int PhysiCell_constants::advanced_Ki67_cycle_model;
}

In some cases the compiler can do constant folding and optimize away references to the static data member, in which case the code can get away without the definition. With -O3 GNU seems to work. With lower optimisation flags, it may complain too. nvc++ is unable to do the constant folding in this particular situation,

It would be best if the code becomes more robust, so that PhysiCell_constants.cpp contained definitions for all the static data members of class PhysiCell_constants. That will make the code able to build in more situations and with more compilers with different optimisation levels.

@rheiland
Copy link
Collaborator

Would you please try using the .h, .cpp versions here? https://github.com/rheiland/PhysiCell/tree/dev-constants/core

@vincent-noel
Copy link
Collaborator

vincent-noel commented Jun 4, 2024

I had someone from Barcelona Supercomputing Center commenting on this, who even submitted a PR to our PhysiBoSS repo. I ended up telling him the PR should be here and closing it (PhysiBoSS#3), but this was his fix: PhysiBoSS@eafaa8c

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

No branches or pull requests

3 participants