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

Newton solver CUDA compatibility with Eigen #45

Merged
merged 2 commits into from
Mar 10, 2019
Merged

Conversation

pramodk
Copy link
Contributor

@pramodk pramodk commented Mar 9, 2019

  • mark newton solver routines with EIGEN_DEVICE_FUNC
    so that the solver can be used from cpu or gpu kernels
  • usable with latest master of eigen
  • update eigen submodule to latest master

Resolves #41

  - mark newton solver routines with EIGEN_DEVICE_FUNC
    so that the solver can be used from cpu or gpu kernels
  - usable with latest master of eigen
  - update eigen submodule to latest master

Resolves #41

Change-Id: I49460a1a16428c3f1ad0b8cacd025f83b96a8389
@pramodk pramodk added the codegen Code generation backend label Mar 9, 2019
@pramodk pramodk added this to the v0.2 milestone Mar 9, 2019
@pramodk pramodk requested review from ohm314 and lkeegan March 9, 2019 13:45
Copy link
Contributor

@lkeegan lkeegan left a comment

Choose a reason for hiding this comment

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

LGTM!

By the way did you find some documentation for EIGEN_DEVICE_FUNC? All I could find was this forum post:
https://eigen.tuxfamily.narkive.com/zeJ54QCx/when-to-mark-eigen-device-func
but based on this it seems that since we use fixed size matrices and therefore don't have any dynamic memory allocations it should work fine on gpus.

Also would it be beneficial to define EIGEN_DEFAULT_DENSE_INDEX_TYPE to int, to use a 32bit int for array indexing instead of the default 64bit? as suggested here:
https://eigen.tuxfamily.org/dox/TopicCUDA.html

@lkeegan
Copy link
Contributor

lkeegan commented Mar 9, 2019

Also by default Eigen will use openMP if enabled in the compiler.
If openMP is already used in coreneuron we should probably set
EIGEN_DONT_PARALLELIZE
to prevent eigen from creating more threads.
see https://eigen.tuxfamily.org/dox/TopicMultiThreading.html

@pramodk
Copy link
Contributor Author

pramodk commented Mar 9, 2019

By the way did you find some documentation for EIGEN_DEVICE_FUNC? All I could find was this forum

I was just grepping through the code :) ...it gets expand to cuda device/host kernel annotation (__host__ __device__) if code is being compiled with NVCC otherwise its empty (see here)

Also would it be beneficial to define EIGEN_DEFAULT_DENSE_INDEX_TYPE to int, to use a 32bit int for array indexing instead of the default 64bit? as suggested here:
https://eigen.tuxfamily.org/dox/TopicCUDA.html

Also by default Eigen will use openMP if enabled in the compiler. If openMP is already used in coreneuron we should probably set EIGEN_DONT_PARALLELIZE

Yeah, good points! We don't want threads from Eigen as simulator already uses OpenMP. If I am not mistaken, those macros should go into somewhere in global header. I created #47.

…des & settings

Change-Id: Ibb92c931933ec657e0ccd3ef83f9ffcb368d934c
@pramodk pramodk merged commit ad9c2ef into master Mar 10, 2019
@pramodk pramodk deleted the pr/eigen-cuda branch March 10, 2019 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen Code generation backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants