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

ExternalProject SUNDIALS 3.2.1 #1960

Open
wants to merge 122 commits into
base: master
Choose a base branch
from
Open

ExternalProject SUNDIALS 3.2.1 #1960

wants to merge 122 commits into from

Conversation

alexsavulescu
Copy link
Member

@alexsavulescu alexsavulescu commented Aug 20, 2022

  • include work from cvode3 branch

closes #1328

  • Cvode version 3 test data must be visually compared to the legacy data for acceptable similarity.
  • Must use nrn-modeldb-ci to visually compare the differences.
  • test coverage substantially complete
  • merge rxd testdata and update submodule commit

@alexsavulescu alexsavulescu changed the title Slds ExternalProject SUNDIALS 3.2.1 Aug 20, 2022
@alexsavulescu alexsavulescu marked this pull request as draft August 20, 2022 12:22
@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

@alexsavulescu alexsavulescu linked an issue May 3, 2023 that may be closed by this pull request
@bbpbuildbot

This comment has been minimized.

@nrnhines
Copy link
Member

nrnhines commented May 5, 2023

@alkino Just to let you know, I have a fix for ctest -R netpar but need to extend to NRNMPI_DYNAMICLOAD.

@alkino
Copy link
Member

alkino commented May 5, 2023

@alkino Just to let you know, I have a fix for ctest -R netpar but need to extend to NRNMPI_DYNAMICLOAD.

NRNMPI_DYNAMICLOAD should be cleaned to be the same than in coreneuron (double implentation today): #2285, so feel free to rework everything

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ b398627 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

@nrnhines nrnhines marked this pull request as ready for review October 28, 2024 17:39
@nrnhines nrnhines requested a review from pramodk October 28, 2024 17:42
@nrnhines
Copy link
Member

@pramodk Feel free to review as briefly as you wish. The most important remaining aspects are for me to check the three boxes in the beginning comment.

Copy link
Member

@pramodk pramodk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad to see this is close to becoming a reality!

I didn’t have time to review the C++ changes, but I think @alkino can help with that.

I have just added two minor comments regarding the build parts.

Comment on lines +22 to +28
GIT_REPOSITORY https://github.com/neuronsimulator/sundials.git
# GIT_TAG e2f29c34f324829302037a1492db480be8828084 6.2.0 -> CVodeMem no longer "visible" GIT_TAG
# c09e732080a214694b209032ec627c93fed45340 4
#GIT_TAG 811234254d37652954daff0ccdb7af9813736846 # 3.2.1
GIT_TAG 71b3daec18ce66a7c011be9501a31567aa5c09b6 # 3.2.1 hines/hoc_pow
# GIT_TAG 7ed895fd102226dbc52225e6b2c6e26ef1cafa0e #2.7.0
# cmake-format: on
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nrnhines : is this LLNL/sundials@main...neuronsimulator:sundials:hines/hoc_pow only change that we need to have? Indeed it's look very trivial.

Copy link
Member

@nrnhines nrnhines Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct for Sundials version 3. We'll eventually see if changes need to be more substantial for later versions. There is some question about where to put the 10 nrn/src/nrniv/nvector_* files. They distinguish between (serial, thread, mpi) and (double, longdouble) and I don't think the changes are relevant to sundials as they have details that depend on how NEURON uses threads and mpi and NRN_ENABLE_MPI_DYNAMIC. At the moment, when
NRN_ENABLE_MPI_DYNAMIC=ON, then nm libnrniv.so | grep MPI shows nothing that points into libmpi. Instead, many things point into mpi specific interface libraries such as libnrnmpi_mpich.so and libnrnmpi_ompi.so . I think the worst case, ultimately, is that sundials gets built for each ```-DNRN_MPI_DYNAMIC="mpi;versions" and then all of sundials gets linked into each of the various libnrnmpi_.so

BUILD_BYPRODUCTS
<INSTALL_DIR>/lib/libsundials_ida.a <INSTALL_DIR>/lib/libsundials_cvode.a
<INSTALL_DIR>/lib/libsundials_nvecserial.a <INSTALL_DIR>/lib/libsundials_nvecpthreads.a
<INSTALL_DIR>/lib/libsundials_nvecparallel.a)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was previously discussed with Alex, but still remember less-than-ideal experiences with ExternalProject_Add during 2016-17. I am still wondering if there might be better alternatives to using nested cmake configure steps. :)

I'll leave it to @alkino and @1uc to weigh in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My experience with ExternalProject_Add for Sundials hasn't been too bad. At least any change to a build at the nrn level propagates to re-compile and build the sundials *.a files (that link into libnrniv.so). It could be better in terms of having a build tree as a subtree in the nrn build tree. (I often use mulitple nrn/build.../ with different cmake option choices and it would be nice if the latest nrn build did not cause the previous sundial build to be overwritten. I would also prefer to avoid git status not showing the untracked folder external/sundials At the moment the sundials repository seems to begin at nrn/external/sundials/src/sundials-external, the build takes place in nrn/external/sundials/src/sundials-external-build, and the install takes place in nrn/external/sundials/(include, lib). I suppose the way we have been handling InterViews and, more recently, fmt, might provide an alternative strategy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all in for ExternalProject_Add 🚀 given that we can do custom build/configure commands, it will be definitely useful for upgrading to newer sundials.

#include "nvector_nrnparallel_ld.h"
#include "sundialsmath.h"
#include "sundialstypes.h"
#define MPI_Comm int // or perhaps get rid of them all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick - just curious about this

Copy link
Member

@nrnhines nrnhines Oct 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am seriously considering removing all references to MPI_Comm in nrn/src/nrniv nvector_parallel.* and nvector_nrnparallel_ld.* . These are basically copies of sundials files from version 2 and 3 but modified to allow
construction from within nrn/src/nrncvode/cvodeobj.cpp and also work without directly calling anything from within mpi.h. That is, they are valid for -DNRN_ENABLE_MPI_DYNAMIC= ON or OFF and don't involve any mpi.h structures (such as MPI_Comm) or functions. They only call things available from nrn/src/nrnmpi/nrnmpi.h. I left in the MPI_Comm tokens just as indicators of what might have to be changed in future movment toward Sundials version 7. At the moment, all of SUNDIALS used by neuron is inside libnrniv.so

@nrnhines
Copy link
Member

@pramodk I was looking at the checkbox you added to the top commit
merge rxd testdata and update submodule commit
and was wondering what is meant. The nrn master already has

commit f8e94c53da9d59570e6922acef6715f85776ff2e
Author: adamjhn <[email protected]>
Date:   Thu Oct 24 14:59:12 2024 -0400

    Move reference data from test_rxd.py to test_rxd.json. (#3143)
    
    
    * Added a --save flag to regenerate the data.

and the sundials version that this PR uses is mentioned in nrn/cmake/modules/FindSUNDIALS.cmake

GIT_REPOSITORY https://github.com/neuronsimulator/sundials.git
GIT_TAG 71b3daec18ce66a7c011be9501a31567aa5c09b6 # 3.2.1 hines/hoc_pow

So it seems the checkbox should have an [x]

-DBUILD_SHARED_LIBS=OFF
-DMPI_C_COMPILER=${MPI_C_COMPILER}
-DCMAKE_INSTALL_LIBDIR=${SUNDIALS_LIB_DIR}
BUILD_BYPRODUCTS
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: this is needed for Ninja

Copy link

✔️ 1c2308c -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 7286d43 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

sonarcloud bot commented Nov 6, 2024

Copy link

✔️ d38be72 -> Azure artifacts URL

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

Successfully merging this pull request may close these issues.

Drop legacy SUNDIALS and go upstream
5 participants