I would like us to consider adding the environment variables ICE_CPPDEFS and ICE_SLIBS to cice.settings.
This would allow using the present case/test configuration mechanism (set_env.* in configuration/scripts/options/) to add preprocessor macros and linker flags.
The reason I'm asking is that in the initial implementation of the implicit solver I'm working on, LAPACK is used for the accelerated algorithm (the Anderson solver), but it is not needed for the regular implicit solver (the Picard solver).
So I was thinking of adding a CICE_USE_LAPACK preprocessor macro so that the model can still be compiled without LAPACK, and one could opt to define this macro if they want to test the accelerated solver and compile with LAPACK.
This could be done by manually editing the Macros.machine_compiler file in the case directory, modifying CPPDEFS and SLIBS, but it would be more user friendly to be able to do
./cice.setup -m <machine> -c /path/to/anderson-case -s dynanderson,lapack
and to have a file configuration/scripts/options/set_env.lapack with content
setenv ICE_CPPDEFS -DCICE_USE_LAPACK
setenv ICE_SLIBS -llapack -lblas
This would only require minimal changes to cice.setup and cice.build (I think) and I would be happy to do that, but I would like to make sure it's something we want to support before spending time doing it.
@apcraig @JFLemieux73
Note that I'm planning on not requiring LAPACK for the final implementation of the accelerated solver. As discussed at the tutorial, I would like to first merge a version of the implicit solver that features:
- The traditional Picard solver (usable in serial or parallel)
- The accelerated Anderson solver (usable only in serial)
This is almost ready for submission. In a second step I would work on the parallelization of the Anderson solver and remove the dependency on LAPACK.
I would like us to consider adding the environment variables
ICE_CPPDEFSandICE_SLIBStocice.settings.This would allow using the present case/test configuration mechanism (
set_env.*inconfiguration/scripts/options/) to add preprocessor macros and linker flags.The reason I'm asking is that in the initial implementation of the implicit solver I'm working on, LAPACK is used for the accelerated algorithm (the Anderson solver), but it is not needed for the regular implicit solver (the Picard solver).
So I was thinking of adding a
CICE_USE_LAPACKpreprocessor macro so that the model can still be compiled without LAPACK, and one could opt to define this macro if they want to test the accelerated solver and compile with LAPACK.This could be done by manually editing the
Macros.machine_compilerfile in the case directory, modifyingCPPDEFSandSLIBS, but it would be more user friendly to be able to doand to have a file
configuration/scripts/options/set_env.lapackwith contentThis would only require minimal changes to
cice.setupandcice.build(I think) and I would be happy to do that, but I would like to make sure it's something we want to support before spending time doing it.@apcraig @JFLemieux73
Note that I'm planning on not requiring LAPACK for the final implementation of the accelerated solver. As discussed at the tutorial, I would like to first merge a version of the implicit solver that features:
This is almost ready for submission. In a second step I would work on the parallelization of the Anderson solver and remove the dependency on LAPACK.