Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Implement support for version from last git commit #392

Merged
merged 7 commits into from
Sep 21, 2020

Conversation

pramodk
Copy link
Collaborator

@pramodk pramodk commented Sep 14, 2020

  • coreneuron version was printed as "version id unimplemented"
  • add cmake module GitRevision.cmake to find git commit information
  • this commit adds support to print project version along with
    git commit and it's date. e.g.
    Version : 0.21.0 bd747a8 (14-09-2020 16:03)

@pramodk
Copy link
Collaborator Author

pramodk commented Sep 14, 2020

@nrnhines : until this gets merged, may be you can just cherry-pick this commit into your branch and test your NEUERON PR?

@nrnhines
Copy link
Collaborator

Strange puzzle. I checked out this pull request Your branch is up to date with 'origin/pramodk/version-info' and

hines@hines-T7500:~/neuron/acell-thread/external/coreneuron$ git log
commit 2521f568c3eeb468700f0fafbc9b28b30622996b (HEAD -> pramodk/version-info, origin/pramodk/version-info)
Author: pramodk <pramod.s.kumbhar@gmail.com>
Date:   Tue Sep 15 01:09:14 2020 +0200

Finally, for NEURON,

hines@hines-T7500:~/neuron/acell-thread$ git show HEAD
commit c7c28a2679172382df76f4d735001a97bee290b3 (HEAD -> acell-thread)
Author: Michael Hines <michael.hines@yale.edu>
Date:   Tue Sep 15 09:38:16 2020 -0400

    Update to use coreneuron with version info.

diff --git a/external/coreneuron b/external/coreneuron
index bd747a8e..2521f568 160000
--- a/external/coreneuron
+++ b/external/coreneuron
@@ -1 +1 @@
-Subproject commit bd747a8e94117bbbe7c8646b8f1a83c0b214b179
+Subproject commit 2521f568c3eeb468700f0fafbc9b28b30622996b

But when I build and launch, I get the nrn version output instead of the coreneuron version. ie.

hines@hines-T7500:~/neuron/acell-thread/test/coreneuron$ python test_datareturn.py
CoreNEURON run
 
 Duke, Yale, and the BlueBrain Project -- Copyright 1984-2020
 Version : 0.21.0 c7c28a26 (15-09-2020 09:38)

@nrnhines
Copy link
Collaborator

By the way, if I launch nrniv-core -h the version is not printed and after all the option help is printed it ends with Aborted (core dumped)

@pramodk
Copy link
Collaborator Author

pramodk commented Sep 15, 2020

Strange puzzle. I checked out this pull request Your branch is up to date with 'origin/pramodk/version-info' and
But when I build and launch, I get the nrn version output instead of the coreneuron version. ie.

Did you commit the commit submodule before launching cmake command? Let me try it and see what's happening.

I have now added --version option in nrniv-core:

$ ./bin/nrniv-core --version
CoreNEURON Version : 0.21.0 2521f56 (2020-09-15 01:09:14 +0200)

By the way, if I launch nrniv-core -h the version is not printed and after all the option help is printed it ends with Aborted (core dumped)

seems like --help was not properly handled. I have changed logic a bit and now it exit cleanly.

@nrnhines
Copy link
Collaborator

I have now added --version option in nrniv-core:

$ ./bin/nrniv-core --version
CoreNEURON Version : 0.21.0 2521f56 (2020-09-15 01:09:14 +0200)

That is interesting as

commit 57856bafbfdc634ed4276c0a9d4a15a3caced32a
Author: Pramod Kumbhar <pramod.s.kumbhar@gmail.com>
Date:   Tue Sep 15 22:14:46 2020 +0200

    Added --version CLI flag

and when I do a fresh build from an empty bldtst

hines@hines-T7500:~/neuron/acell-thread/bldtst$ cmake .. -DCMAKE_INSTALL_PREFIX=install -DNRN_ENABLE_CORENEURON=ON -DNRN_ENABLE_TESTS=ON -DIV_DIR=$HOME/neuron/ivcmake/build/install
...
make -j install
...
hines@hines-T7500:~/neuron/acell-thread/bldtst$ which nrniv-core
/home/hines/neuron/acell-thread/bldtst/install/bin/nrniv-core
hines@hines-T7500:~/neuron/acell-thread/bldtst$ nrniv-core --version
CoreNEURON Version : 0.21.0 c7c28a26 (2020-09-15 09:38:16 -0400)

So there must be something stupidly obvious that I'm missing.

@nrnhines
Copy link
Collaborator

I wonder if, when one builds coreneuron as a submodule, the git commands from within the nrn build folder are getting some nrn git info instead of from nrn/external/coreneuron

@pramodk
Copy link
Collaborator Author

pramodk commented Sep 15, 2020

I wonder if, when one builds coreneuron as a submodule, the git commands from within the nrn build folder are getting some nrn git info instead of from nrn/external/coreneuron

Ahh yes! my bad! I am using CMAKE_SOURCE_DIR which will be nrn directory with submodule:

  execute_process(
    COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_REVISION_SHA1
    ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
  # get last commit date
  execute_process(
    COMMAND ${GIT_EXECUTABLE} show -s --format=%ci
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_REVISION_DATE
    ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)

@pramodk
Copy link
Collaborator Author

pramodk commented Sep 16, 2020

Please retest

@pramodk pramodk force-pushed the pramodk/version-info branch from c22bf8b to bb4df8f Compare September 21, 2020 11:25
@pramodk
Copy link
Collaborator Author

pramodk commented Sep 21, 2020

Retest this please

@pramodk
Copy link
Collaborator Author

pramodk commented Sep 21, 2020

Please retest

@pramodk
Copy link
Collaborator Author

pramodk commented Sep 21, 2020

Retest this please

1 similar comment
@pramodk
Copy link
Collaborator Author

pramodk commented Sep 21, 2020

Retest this please

pramodk and others added 6 commits September 21, 2020 19:06
  - coreneuron version was printed as "version id unimplemented"
  - add cmake module GitRevision.cmake to find git commit information
  - this commit adds support to print project version along with
    git commit and it's date. e.g.
      Version : 0.21.0 bd747a8 (14-09-2020 16:03)
Use git show instead of git show to be compatible with older git (e.g. on BB5)
@pramodk pramodk force-pushed the pramodk/version-info branch from bb4df8f to 04b6164 Compare September 21, 2020 17:06
@pramodk pramodk merged commit e0a2774 into master Sep 21, 2020
@pramodk pramodk deleted the pramodk/version-info branch September 21, 2020 18:26
pramodk added a commit to neuronsimulator/nrn that referenced this pull request Nov 2, 2022
…lueBrain/CoreNeuron#390 (BlueBrain/CoreNeuron#392)

* Implement support for version from last git commit
  - coreneuron version was printed as "version id unimplemented"
  - add cmake module GitRevision.cmake to find git commit information
  - this commit adds support to print project version along with
    git commit and it's date. e.g.
      Version : 0.21.0 bd747a8e (14-09-2020 16:03)
* Added --version CLI flag
  - Use git show instead of git show to be compatible with older git (e.g. on BB5)
* Avoid nrn_abort when --help is called
* Bug fix for merged pull request BlueBrain/CoreNeuron#390 : tid and ith args were mixed
* For BB5 Jenkins, exclude problematic agent bb5-07 (has strange PGI compiler issue)

Co-authored-by: Michael Hines <michael.hines@yale.edu>

CoreNEURON Repo SHA: BlueBrain/CoreNeuron@e0a2774
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants