madscatt / zazzie

development branch
GNU General Public License v3.0
2 stars 3 forks source link

sascalc_library restructuring and compilation / installation strategy #9

Open madscatt opened 8 years ago

madscatt commented 8 years ago

I have reorganized the file layout of the sascalc_library

>>> ls sascalc_library/
__init__.py                extensions/                sascalc_lib.py             
box_converge_lib.py        sascalc_library_extension.cpp  setup_sascalc_library.py 

and

>>> ls sascalc_library/extensions/
Makefile*   lib/        src/

We need to write a Python script to take care of the compilation of the CPP/CUDA code. It is also important to use "installation flags / variables" at a higher level so that the Makefile and setup_sascalc_library.py files can be executed without requiring the user to edit these files by hand.

Since distutils can only handle one compiler at a time and we need both g++ and nvcc it is not possible to use distutils natively to handle this. I suggest we design, write and implement a script to take care of the compilation (c++ and/or cuda). Then this script should be tested and worked through with more system wide installation flags / variables as mentioned above.

There are a few mentions of how to bootstrap compilation of cuda code into distutils but that may be quite difficult at the higher level when we incorporate all of the various extensions in sassie that are within many modules.

see:

https://github.com/rmcgibbo/npcuda-example/blob/master/swig/setup.py

One possibility is to write specific bootstrapping distutils capability into the setup_sascalc_library.py script and then merely call that from the main setup.py installation script that will handle the "normal" C++ extensions in the code base. If we do this we should capture errors etc.

As of today, the only other extension is the cpp/cuda overlap/ method moved from core_libraries_1.0 to sassie/simulate/torsion_angle_monte_carlo/extensions/. What is implemented for sascalc_library should consider other extension modules in the code base.

(NOTE: I would like to change the names of a few files by replacing the old, incorrect _api* with the more appropriate _library*.)

madscatt commented 8 years ago

We also need to implement options to only compile the C++ version for those installation scenarios where CUDA libraries are either not available or not the correct version.

hailiangzhang commented 8 years ago

We also need to implement options to only compile the C++ version for those installation scenarios where CUDA libraries are either not available or not the correct version.

make cpu will do that

madscatt commented 8 years ago

Merged the pull request with new setup_cpu.py & setup_gpu.py. I will test them separately, and then overall using the top-most setup.py (or installer.py) as a driver of the overall installation.