-
Notifications
You must be signed in to change notification settings - Fork 41
Fixing nrnivmodl-core: Avoid redefined symbols + script startup fixes #133
Conversation
236719a
to
3c6eaee
Compare
@pramodk I don't think we expected this much work :p but it was a nice challenge! |
extra/CMakeLists.txt
Outdated
# Disable new-dtags with newer linkers | ||
############################################################ | ||
|
||
if (UNIX AND NOT APPLE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to avoid this workaround I think we could live with RUNPATH by setting it also in the shared libraries (apparently it allows that). Shall I experiment with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without that --disable-dtags option, the RUNPATH is populated correctly but still get library not found error. Didnt understand that quite well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be related to the fact that they are used a bit differently by the dynamic loader: See Bug #1253638 “dynamic linker does not use DT_RUNPATH for transitive dependencies
If I understood well, RUNPATH is only valid for direct dependencies, but sub-dependencies can also define RUNPATH which gets also checked. I kind of agree with the new behavior, but true, breaks things
yeah....too much headache though! :) |
@pramod I linked using gold, checked it produces RUNPATH, but still it all works in bb5. Is it something specific to ubuntu? |
705fd62
to
ed4fcbb
Compare
@@ -315,8 +312,8 @@ add_library(coreneuron ${COMPILE_LIBRARY_TYPE} ${coreneuron_all_headers} ${coren | |||
${coreneuron_all_c_files} ${cudacorenrn_objs} ${MOD2C_STDMECH_OUTPUTS}) | |||
add_dependencies(coreneuron kinderiv) | |||
|
|||
target_link_libraries(coreneuron ${MPI_CXX_LIBRARIES} | |||
${link_reportinglib} ${CUDA_LIBRARIES}) | |||
target_link_libraries(coreneuron ${MPI_CXX_LIBRARIES} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${cudacorenrn_objs} doesnt exist now, right?
No longer first-found functions in linking. We now strip scoptmath from the core and link together with generated mods when creating coreneuron_app or special-core
To avoid client applications to use three instructions every time they need to run core neuron with mechanisms, we create an intermediate library (corenrnmech, similar to the process of nrnivmodl-core) which contains the extra mechanisms and a solve_core() launcher, besides all dependent registration/hook routines (mod_func.cpp and dimplic.cpp)
Some newer systems use the gold linker which creates RUNPATH instead of RPATH. This may be problematic as apparently it doesnt propagate the RPATH to dependencies. To mitigate the problem (without disabling new dtags) we: - Set libcoreneuron as a direct dependency - Set rpath on libcorenrnmech itself (LD should ignore, GOLD should take it) - This shouldnt be needed due to the previous measure, but it's actually a good practice.
In mac $ORIGIN is called @loader_path. Therefore mac builds would only work once installed. Fixed. Second. To avoid having a superfluous RPATH, now we create a nrnivmech_install.sh script which calls gnu make "install". It will relink the executable setting the destination RPATH, and install the files
c1355a0
to
3a09d20
Compare
# The coreneuron lib (only internal mechanisms) | ||
# | ||
add_library(coreneuron ${COMPILE_LIBRARY_TYPE} ${coreneuron_all_headers} ${coreneuron_all_templates} | ||
${coreneuron_all_c_files} ${cudacorenrn_objs} ${MOD2C_STDMECH_OUTPUTS}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
${coreneuron_all_c_files} ${cudacorenrn_objs} ${MOD2C_STDMECH_OUTPUTS}) | |
${coreneuron_all_c_files} ${MOD2C_STDMECH_OUTPUTS}) |
@@ -68,7 +68,7 @@ struct ReportConfiguration { | |||
double start; // start time of report | |||
double stop; // stop time of report | |||
int num_gids; // total number of gids | |||
size_t buffer_size; // hint on buffer size used for this report | |||
int buffer_size; // hint on buffer size used for this report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int buffer_size; // hint on buffer size used for this report | |
int buffer_size; // hint on buffer size used for this report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ferdonline : there is one little issue I faced with GPU build described in #141. But that seems unrelated to this PR and I will take of this next.
Looking cmake & nrnivmodl-core, it doesn't seem like clean workflow and lot to improve. But I will keep energy for v2 refactoring :)
…#133) * Fixing nrnivmodl-core: dir creation, shbang * Remove unnecessary mkdir step, create core sub-directory under x86_64 * Avoiding duplicate symbols when using nrnivmodl-core * Generating libcorenrnmech featuring solve_core() * Create an intermediate library (corenrnmech, similar to the process of nrnivmodl-core) which contains the extra mechanisms and a solve_core() launcher, besides all dependent registration/hook routines (mod_func.cpp and dimplic.cpp) * Recompile kinderiv dependencies * Install libcudacoreneuron; link missing * Set rpath on libcorenrnmech * Fix for GPU. Simplified build and fixed link flag * Fixing rpath Origin in Mac and added deploy script * Remove Wall flags from default compilation * Cleanup debug messages in GPU implementation
…BlueBrain/CoreNeuron#133) * Fixing nrnivmodl-core: dir creation, shbang * Remove unnecessary mkdir step, create core sub-directory under x86_64 * Avoiding duplicate symbols when using nrnivmodl-core * Generating libcorenrnmech featuring solve_core() * Create an intermediate library (corenrnmech, similar to the process of nrnivmodl-core) which contains the extra mechanisms and a solve_core() launcher, besides all dependent registration/hook routines (mod_func.cpp and dimplic.cpp) * Recompile kinderiv dependencies * Install libcudacoreneuron; link missing * Set rpath on libcorenrnmech * Fix for GPU. Simplified build and fixed link flag * Fixing rpath Origin in Mac and added deploy script * Remove Wall flags from default compilation * Cleanup debug messages in GPU implementation CoreNEURON Repo SHA: BlueBrain/CoreNeuron@8fa8c48
Fixes to nrnivmodl-core and required changes in the build of coreneuron
Current implementation of nrnivmodl-core suffers from a complex problem, redefinition of some symbols which depend on the mechanism set:
modl_reg()
and those defined indimplic.cpp
This PR fixes that problem (and other little ones) from the root which required changes in the organization of coreneuron libraries and executables.
Short summary:
modl_reg()
call was accordingly moved outmain1.cpp
scopmath_core
package excluded from thelibcoreneuron
toosolve_core
was split intomk_mech_init
andrun_solve_core
corenrnmech
) for the previous purpose, which includesmodl_reg()
.solve_core()
(which callsmodl_reg()
) and full scopmath_core (+ dimplic.cpp)libcoreneuron
solve_core()
from corenrnmech lib (importing the newenginemech.h
header)When building mods with
nrnivmodl-core
the process is the same!Note that in order to optionally build-up on previous mechanism, the ADDITIONAL mechamisms are exported as cpp files to
share/mod2c
and bundled together with the new mods cpp's.See the diagram below.