Skip to content

cosmic-reionization/pyC2Ray

Repository files navigation

pyC2Ray: A flexible and GPU-accelerated radiative transfer framework

pyc2ray is the updated version of C2Ray (G. Mellema, I.T. Illiev, A. Alvarez & P.R. Shapiro, 2006), an astrophysical radiative transfer code widely used to simulate the Epoch of Reionization (EoR). pyc2ray features a new raytracing method developed for GPUs, named Accelerated Short-characteristics Octhaedral RAytracing (ASORA). pyc2ray has a modern python interface that allows easy and customizable use of the code without compromising computational efficiency. A full description of the update and new raytracing method can be found at Hirling, Bianco, Giri, Iliev, Mellema & Kneib (2024).

The core features of C2Ray, written in Fortran90, are wrapped using f2py as a Python extension module, while the new raytracing library, ASORA, is implemented in C++ using CUDA. Both are native Python C extensions and can be directly accessed from any Python script.

Visit the ReadTheDocs of pyc2ray for the complete documentation, tutorials, installation instructions, and more.

Installation

Requirements:

  • C++ compiler that supports the c++20 standard, e.g. gcc >= 12.0
  • Fortran compiler, e.g. gfortran >= 12.0
  • CUDA toolkit with nvcc compiler, at least version 12.0

In your environment simply run

pip install .

To specify a different host compiler for nvcc than the default one, you can run

pip install . -Csetup-args="-Dcuda_ccbindir=my-other-compiler"

If the setuptools method doesn't work, you can alway compile the libraries manually.

Please see our documentation for step-by-step instructions on how to install pyc2ray.

A few example scripts summarizing the installation steps can be found in the repository /install_script/.

TODO list

Here we list a series of numerical and astrophysical implementations we would like to include in future version of pyc2ray.

  • Helium ionization, HeII and HeIII
  • Sources radiative feedback
  • Sources X-ray heating
  • GPU implementation of the chemistry solver
  • multi-frequency UV radiation

CONTRIBUTING

If you find any bugs or unexpected behavior in the code, please feel free to open a Github issue. The issue page is also good if you seek help or have suggestions for us.

Submitting changes to the code

Please follow these instructions to ensure a smooth integration, at least until a CI system is put into place:

  1. Only the first time, install pre-commit in your enviornment and the pre-commit hooks with pre-commit install.
  2. Create a new branch off the main trunk and make your modifications there.
  3. Commit your changes and fix any issue highlighted by the pre-commit hooks; code format is automatically fixed.
  4. Push your branch to the remote repository.
  5. Open a Pull Request on GitHub to the main branch.
  6. It is strongly suggested to squash all the commits into one.
  7. In the PR's description on GitHub, specify blocking dependencies with the message "Depends on #..." and close issues with "Closes #...".
  8. Ask the code to be reviewed before merging.

AKNOWLEDGMENT

This project was initially developed by Patrick Hirling as part of the astrophysics practical workshop supervised by Michele Bianco during his master's degree at EPFL. You can find the original version of the code on his GitHub page: asora.

About

A flexible and GPU-accelerated Radiative Transfer Framework for Simulating the Cosmic Epoch of Reionization

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors