Installation
COLLAPSO1D supports gfortran
and Intel's Classic Fortran ifort
. The latter runs ~70% faster, but requires a more involved installation. Instruction are given for Linux (tested on Ubuntu 20.04 and 22.04), with Mac specific commands in spoilers.
Defendencies
pybind11
Python bindings for C++, which are necessary for the PyTorch wrapper.
CMake
Make sure you have cmake
or install it by (tested on cmake==3.22.1
)
Mac OS
PyTorch
To install the latest PyTorch 1.X or 2.X for CPU, follow the official instructions. Explicitly, the code has been tested with torch==1.13.1
and 2.0.1
. I would highly recommend installing it in a dedicated conda environemnt. As an example, here is how to create one and install PyTorch:
Warning
torch>=1.13.1
will work for inferencing, hence for the CCSN code will be fine, but loading and training the model will fail. Thus, resnet_forward
will still work, but polynomial
example will fail.
EOS Tables
You will also need to download the SFHo EOS Table and put it in the executable directory.
Mac OS
GFORTRAN
Both the main CCSN code and the PyTorch wrapper can be compiled with gfortran >= 9.4.0
. If missing, install it via:
Mac OS
In the Makefile
, set
HDF5
EOS tables (SFHo by default) require an hdf5
installation. If missing, get it via:
hdf5
libraries in the Makefile
. If yours differ from default, edit:
Mac OS
Add the following to you ~/.bashrc
and then source ~/.bashrc
:
Mac OS
You should add the above line to .bash_profile
instead. Create it if it doesn't exist.
Test Installation
Run the following to test your installation
Intel ifort
I would highly recommend installing Intel's oneAPI through APT
. Even though there are many options listed, a good number of them are bugged. In addition, we need to install a full basekit, instead of only the Fortran compiler, as there are issues with individual packages.
Please follow APT Installation Guide on Intel's website to install intel-hpckit
. After the pre-installation steps, you should run the following:
PATH
. The easiest way is to run:
~/.bashrc
to avoid re-running the above initialization on every start-up.
In the Makefile
, set
Warning
The readout.f90
to convert unformatted binary output to readable text will still be compiled with gfortran
(hardcoded in the Makefile
), since ifort
is ~x20 slower at parsing unformatted binary files for some reason. These slow downs have no effect of the actual CCSN calculation, hence ifort
remains vastly superior for the main code.
HDF5 with ifort
To use COLLAPSO1D with EOS Tables, we will also need to re-compile the hdf5
library with ifort
. For that, we need to do a custom installation of hdf5
. I tested on hdf5-1.12.2.
- Download the latest HDF5 Source Code.
- Configure
- Install
- Check
- Add library path
Add the above to your
~/.bashrc
to avoid re-running the above initialization on every start-up
Full installation instructions detailing all of the available commands and flag can be found inside your hdf5 directory in release_docs/INSTALL
.
Lastly, don't forget to change in the COLLAPSO1D's Makefile
.
Troubleshoot
No CMAKE_CXX_COMPILER could be found
CMake can't find your C compiler. Either check your GCC path or if you are on Ubuntu, run:
Version Compatibility Issues
If you are having trouble getting the dependencies and COLLAPSO1D to work, please check the GitHub compilation test. The script sets up a clean Linux environment with explicitely defined package versions. It checks if COLLAPSO1D compiles correctly with gfortran
on every push to the repo.