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

kschan: use eigen instead of sparse13 #2489

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

Conversation

alkino
Copy link
Member

@alkino alkino commented Sep 5, 2023

kschan is using a sparse13 matrix to <fill the blank>, we replace it with a Eigen::SparseMatrix.

During the process we remove variables elms_ and diag_. diag_ was a list of all diagonal value accessed by direct raw pointers, elms_ were the useful values of the matrix store as direct raw pointers to internal of the matrix too.
We needed to remove it, because, with Eigen, the matrix can be relocated and so the pointers be invalidate.

A second change is to store the matrix as a value inside the class instead of a pointer.

We should have take care about the fact that sparse13 matrix are 1-indexed and Eigen is 0-indexed.

Last, we store the solver along the matrix Eigen::SparseLU. This is a sparse solver using the LU decomposition.

@azure-pipelines
Copy link

✔️ 7870b75 -> Azure artifacts URL

@alkino alkino marked this pull request as ready for review September 6, 2023 08:38
@alkino alkino closed this Sep 6, 2023
@alkino alkino reopened this Sep 6, 2023
@azure-pipelines
Copy link

✔️ 7870b75 -> Azure artifacts URL

Copy link
Member

@nrnhines nrnhines left a comment

Choose a reason for hiding this comment

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

Nice. I suppose, eventually, this strategy can be used to eliminate sparse13 entirely. We'll just want to verify that performance is equal or better.

Base automatically changed from cornu/add_eigen to master October 12, 2023 20:41
@alkino alkino marked this pull request as draft November 27, 2023 11:36
Copy link

✔️ ca688b0 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 8a05c9e -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

@bbpbuildbot

This comment has been minimized.

@alkino
Copy link
Member Author

alkino commented Nov 28, 2023

@nrnhines results changed... again.

Copy link

✔️ 72f7558 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link
Contributor

github-actions bot commented Jan 8, 2024

NEURON ModelDB CI: launching for d2c2f77 via its drop url

@bbpbuildbot

This comment has been minimized.

Copy link
Member

@ohm314 ohm314 left a comment

Choose a reason for hiding this comment

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

looks good to me

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 211a7cb -> Azure artifacts URL

@alkino
Copy link
Member Author

alkino commented Jan 8, 2024

Last difference is

strdiff -0.985562 -0.985563
strdiff -49.3732 -49.3733
strdiff -0.0788185 -0.0788184
strdiff -0.00333632 -0.00333631

Copy link

✔️ e5dca68 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

@alkino
Copy link
Member Author

alkino commented Jan 16, 2024

@nrnhines if you have some time to look at the difference in result of this PR, I can have a call with you to give you more explanation of the code.

Copy link

✔️ 531c252 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 72b7cdc -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ baaf458 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

Copy link

✔️ 9f21585 -> Azure artifacts URL

@bbpbuildbot

This comment has been minimized.

@nrnhines
Copy link
Member

Last difference is

strdiff -0.985562 -0.985563
strdiff -49.3732 -49.3733
strdiff -0.0788185 -0.0788184
strdiff -0.00333632 -0.00333631

At the moment, this only appears from NEURON Code Coverage / Code Coverage (pull_request) Failing after 32m?
No other CI is failing and I'm not seeing the problem with

cmake .. -G Ninja -DCMAKE_INSTALL_PREFIX=install -DPYTHON_EXECUTABLE=`which python` -DNRN_ENABLE_TESTS=ON
ninja install
ctest -R hoctests::test_neurondemo_py

Have you ever seen the CI error on your machine? If so, what cmake did you use.
The cmake of that CI appears to be

PYTHON_MIN_NAME: python3.8
PYTHON_MID_NAME: python3.10
PYTHON_MAX_NAME: python3.11
MUSIC_INSTALL_DIR: /opt/MUSIC

export CC=gcc 
export CXX=g++
export PYTHON_MIN=$(which $PYTHON_MIN_NAME)
export PYTHON_MID=$(which $PYTHON_MID_NAME)
export PYTHON_MAX=$(which $PYTHON_MAX_NAME)
mkdir build && cd build
cmake_args=(-G Ninja \
    -DCMAKE_BUILD_TYPE=Debug \   
    -DCMAKE_C_COMPILER="$CC" \   
    -DCMAKE_CXX_COMPILER="$CXX" \
    -DNRN_ENABLE_BACKTRACE=ON \ 
    -DNRN_ENABLE_CORENEURON=ON \
    -DNRN_ENABLE_COVERAGE=ON \  
    -DNRN_ENABLE_INTERVIEWS=ON \
    -DNRN_ENABLE_MPI=ON \
    -DNRN_ENABLE_PERFORMANCE_TESTS=OFF \
    -DNRN_ENABLE_PROFILING=ON \
    -DNRN_ENABLE_PYTHON=ON \
    -DNRN_ENABLE_PYTHON_DYNAMIC=ON \
    -DNRN_PYTHON_DYNAMIC="${PYTHON_MIN};${PYTHON_MAX}" \
    -DNRN_PYTHON_EXTRA_FOR_TESTS=${PYTHON_MID} \
    -DNRN_ENABLE_TESTS=ON \
    -DNRN_ENABLE_MUSIC=ON \
    -DCMAKE_PREFIX_PATH="${MUSIC_INSTALL_DIR}" \
    -DMUSIC_ROOT="${MUSIC_INSTALL_DIR}")
cmake .. "${cmake_args[@]}"

Copy link

sonarcloud bot commented Feb 22, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link

✔️ 03ab16f -> 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.

None yet

4 participants