Skip to content

Commit

Permalink
Merge pull request #43 from tberlok/cleanup
Browse files Browse the repository at this point in the history
Docs and new GPU widget notebook
  • Loading branch information
tberlok authored Jan 21, 2024
2 parents 7882623 + cbce628 commit 370d656
Show file tree
Hide file tree
Showing 10 changed files with 1,888 additions and 41 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/manylinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ jobs:
# How to make a pip installation on my Mac:
# make clean
# python3 setup.py sdist bdist_wheel
# CC=gcc-13 python3 setup.py sdist bdist_wheel
# twine check dist/*
# twine upload dist/*
## twine upload dist/*
# twine upload dist/paicos*.tar.gz
39 changes: 28 additions & 11 deletions docs/source/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ can be seen on the sidebar on the left).

## Turn units/automatic derivations on/off

Some users might not like the automatic handling of units
You might not like the automatic handling of units
and/or the automatic computations of derived quantities.
These features are optional and can be turned off.

Expand All @@ -22,12 +22,12 @@ You can also turn off automatic derivations by running the following code.
import paicos as pa
pa.use_only_user_functions(True)
```
This can be used to turn off the library of functions supplied by Paicos
and replace them with your own functions instead (see the "Custom user functions"
This can be used to turn off the library of functions supplied by Paicos.
You can then replace them with your own functions instead (see the "Custom user functions"
section below).

It is worth noting that these options should be modified before loading any snapshots,
i.e. at the top of your analysis scripts or in your `user_settings.py` file (see below).
i.e. at the top of your analysis scripts or in your `paicos_user_settings.py` file (see below).

## Custom user units

Expand All @@ -39,7 +39,7 @@ option in Arepo or if your simulations include some non-standard physics options
pa.add_user_unit('voronoi_cells', 'JetTracer', '')
```

This let's Paicos know that your Arepo snapshots contain a block
This lets Paicos know that your Arepo snapshots contain a block
name JetTracer in the gas cells. You can get the full documentation
by running
```
Expand All @@ -64,7 +64,7 @@ def TemperaturesTimesMassesSquared(snap, get_depencies=False):
pa.add_user_function('0_TM2', TemperaturesTimesMassesSquared)
```
After setting this up, one would be able to run e.g.
After setting this up, the user would be able to run e.g.

```
snap = pa.Snapshot(root_dir + '/data', 247)
Expand All @@ -75,8 +75,8 @@ snap['0_TM2']

## Openmp parallel execution of code

Paicos will check upon startup how many cores are available on your system,
which might be limited to the number set in the environment variable OMP_NUM_THREADS.
Paicos will upon startup check how many cores are available on your system.
This might be limited to the number set in the environment variable OMP_NUM_THREADS.

It is therefore sometimes useful to set the environment variable OMP_NUM_THREADS,
which will then be the maximum number of threads that Paicos can use.
Expand All @@ -92,14 +92,25 @@ would use 24 cores in the parts of the code that are parallelized.

## Setting up user settings

You can save a `user_settings.py` script at in Paicos base directory. We include an example
named ``, which you use to get started. It looks like this
You can save a `paicos_user_settings.py` script at the location of the Paicos code,
which is imported when you do `import paicos`.
The location of this directory depends on whether you have done a pip installation or not.
You can find the correct location by doing this:

```
import paicos as pa
print('Put your paicos_user_settings.py in this directory:', pa.code_dir)
```

We include an example named `paicos_user_settings_template.py`, which you can use to get started.
It looks like this

```
import paicos as pa
"""
Set up your own default settings by renaming this file as user_settings.py.
Set up your own default settings by renaming this file as paicos_user_settings.py
and saving it at the directory found at: pa.code_dir
Here we are overriding the defaults set in settings.py, so you only need
to add things you want to change.
Expand All @@ -118,6 +129,12 @@ pa.numthreads(8)
# Info about the openMP setup
pa.give_openMP_warnings(False)
# Whether to load GPU/cuda functionality on startup
pa.load_cuda_functionality_on_startup(False)
# Explicitly set data directory (only needed for pip installations)
data_dir = '/Users/berlok/projects/paicos/data/'
# Examples of adding user-defined functions
def TemperaturesTimesMassesSquared(snap, get_dependencies=False):
Expand Down
17 changes: 16 additions & 1 deletion docs/source/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ wget -O data/fof_subhalo_tab_247.hdf5 https://sid.erda.dk/share_redirect/BmILDaD
wget -O data/snap_247.hdf5 https://sid.erda.dk/share_redirect/G4pUGFJUpq
```

If you have done a pip-installation, then you will need to tell Paicos where the data is on your system.
This is done by adding something like this
```
# Explicitly set data directory (only needed for pip installations)
data_dir = '/Users/berlok/projects/paicos/data/'
```
to your `paicos_user_settings.py` (see the user configuration tab).

## Overview of the main Paicos classes
The notebooks and python scripts illustrate typical use cases of the following Paicos classes:

Expand All @@ -32,4 +40,11 @@ The notebooks and python scripts illustrate typical use cases of the following P

- PaicosWriter (paicos_writer.py)

- PaicosReader (paicos_readers.py)
- PaicosReader (paicos_readers.py)

## Main GPU classes

The main GPU classes are

- GpuSphProjector (gpu_sph_projector.py)
- GpuRayProjector (gpu_ray_projector.py)
2 changes: 2 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ caption: Notebook examples
/notebooks/histogram2d.ipynb
/notebooks/histogram2d_plotting.ipynb
/notebooks/gpu_ray_with_widget_and_logging_v2.ipynb
```

```{toctree}
Expand Down
Loading

0 comments on commit 370d656

Please sign in to comment.