Closed JiaweiZhuang closed 5 years ago
A better way to skip hemco_standalone.x
is changing HEMCO/Makefile:
from
all:
@$(MAKE) lib
...
lib:
@$(MAKE) libHCO
@$(MAKE) libHCOX
@$(MAKE) libHCOI
@$(MAKE) exe
to
all:
@$(MAKE) lib
@$(MAKE) exe
...
lib:
@$(MAKE) libHCO
@$(MAKE) libHCOX
@$(MAKE) libHCOI
This feels a lot more intuitive as lib
only contains object files while all
also contains executable.
Right now the above all
target is not used at all. The top-level GeosCore/Makefile only goes to lib
:
libhemco: # Build code in HEMCO/*
@$(MAKE) -C $(HEMCO) lib
So, hemco_standalone.x
will not be compiled in any case, for both classic and HP.
If users do want to get hemco_standalone.x
, the above unused all
can be used to implement one more option, like:
hemco_standalone: # Build hemco_standalone.x
@$(MAKE) -C $(HEMCO) all
Thanks for coming up with this solution. In the past I adjusted the makefile during debugging to skip compiling the HEMCO standalone since it is indeed not used. It makes sense to make this the default. I will keep this issue open until we put it into an upcoming version and test it.
I pushed a fix for this. We use the Makefile_header.mk variable IS_HPC to prevent building the hemco_standalone.x executable if we are building GC for an HPC environment.
@$(MAKE) libHCO
@$(MAKE) libHCOX
@$(MAKE) libHCOI
ifeq ($(IS_HPC),0)
@$(MAKE) exe
endif
At the very end of compilation,
hemco_standalone.x
is compiled by:This runs on CentOS but crashes on Ubuntu (the extremely common
undefined reference to `__netcdf_MOD_nf90_create'
error), because Ubuntu requires-lnetcdff -lnetcdf
to appear after the object that uses it (https://stackoverflow.com/a/13953322/8729698).This can be fixed by adding
-lnetcdf -lnetcdff
to the very end of the command:But how to add this to the Makefile gets a bit tricky.
A simpler way is to skip the compilation of
hemco_standalone.x
, since it is not used in GCHP anyway (does it even work?).This can be done by changing the dependency in
HEMCO/Interfaces/Makefile
fromto
hemco_standalone.x
skipped: compile_no_hemco_success.logMy question is
hemco_standalone.x
by default?