nrn icon indicating copy to clipboard operation
nrn copied to clipboard

ExternalProject SUNDIALS 3.2.1

Open alexsavulescu opened this issue 3 years ago • 60 comments

  • include work from cvode3 branch

closes #1328

  • [x] 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.
  • [x] test coverage substantially complete
  • [x] merge rxd testdata and update submodule commit

alexsavulescu avatar Aug 20 '22 12:08 alexsavulescu

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

nrnhines avatar May 05 '23 07:05 nrnhines

@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): https://github.com/neuronsimulator/nrn/issues/2285, so feel free to rework everything

alkino avatar May 05 '23 08:05 alkino

src/nrnmpi/nrndynam.cpp has the comment

// Only works if caller is compiled with same MPI version that is
// dynamically loaded.

Which was intended to imply that because sundials uses mpi, NRNMPI_DYNAMIC_LOAD was incomplete because libnrniv.so (which contains all the sundials functions) still referred to some MPI methods which made the entire distribution specific to the build machine version of MPI.

However this is not the case. NRNMPI_DYNAMIC_LOAD can be built with several versions of MPI and will work on any user machine that has one of those MPI versions installed. It turns out that the only sundials library archive that refers to MPI is libsundials_nvecparallel.a and during link time, nothing from that archive is added to the shared library because all the relevant functions are added by earlier linking against nrn/src/nrniv/nvector_parallel.c (which is basically a modified copy of external/sundials/src/sundials-external/src/nvec_par/nvector_parallel.c)

To make this clear, I recommend modifying src/nrniv/CMakeLists.txt to remove the fragment

if(NRN_ENABLE_MPI)
  target_link_libraries(nrniv_lib ${SUNDIALS_LIB_DIR}/libsundials_nvecparallel.a)
endif()

I'll make and test this change.

nrnhines avatar May 17 '23 12:05 nrnhines

It is difficult getting tests to pass in a principled manner with respect to quantitative identity of results. Differences are sometimes seen with respect to architecture, operating system, floating point differences between transcendental functions (pow(x,y) for example), compiler version, order of summation (eg. threads, MPI), and, now, cvode version. I'm guessing that it might be worthwhile to use a test strategy that does a series of cvode runs with a series of a absolute tolerances at fixed exact time points and event times and verify that the "results" approach an asymptotic standard result.

I've gotten cvodeobj.cpp to compile with Sundials v 6 and when the whole thing compiles will see if I can get some tests such as test_nrntest_fast.py modified to pass for cv2, 3, 6 on windows/mac/linux

nrnhines avatar Jun 01 '23 13:06 nrnhines

It is difficult getting tests to pass in a principled manner with respect to quantitative identity of results. Differences are sometimes seen with respect to architecture, operating system, floating point differences between transcendental functions (pow(x,y) for example), compiler version, order of summation (eg. threads, MPI), and, now, cvode version. I'm guessing that it might be worthwhile to use a test strategy that does a series of cvode runs with a series of a absolute tolerances at fixed exact time points and event times and verify that the "results" approach an asymptotic standard result.

I've gotten cvodeobj.cpp to compile with Sundials v 6 and when the whole thing compiles will see if I can get some tests such as test_nrntest_fast.py modified to pass for cv2, 3, 6 on windows/mac/linux

Should we pass to sundials 6 directly?

alkino avatar Jun 01 '23 13:06 alkino

Should we pass to sundials 6 directly?

I don't think so. Undoubtedly there are bugs in my modifications. At this point, it is just another example see if we can eliminate version specific data for CI tests.

nrnhines avatar Jun 01 '23 14:06 nrnhines

/root/nrn/external/sundials/lib64/libsundials_ida.a

lib vs lib64 from sundials, I don't know how to know that from findSUNDIALS.cmake

alkino avatar Jun 01 '23 17:06 alkino

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 78 Code Smells

No Coverage information No Coverage information
0.7% 0.7% Duplication

sonarqubecloud[bot] avatar Nov 05 '23 01:11 sonarqubecloud[bot]

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

78 New issues
0 Security Hotspots
No data about Coverage
0.7% Duplication on New Code

See analysis details on SonarCloud

sonarqubecloud[bot] avatar Dec 30 '23 15:12 sonarqubecloud[bot]