Skip to content

Instantly share code, notes, and snippets.

View smutch's full-sized avatar

Simon Mutch smutch

View GitHub Profile
@smutch
smutch / std_conda_environment.yml
Last active January 3, 2020 07:09
Standard conda environment for astro work on HPC system
# invoke with:
# env CC=`which mpicc` HDF5_MPI="ON" MPICC=`which mpicc` conda env create -f=std_conda_environment.yml
name: std
channels:
- conda-forge
- defaults
dependencies:
- nomkl
- pip
- black
@smutch
smutch / cmake_prefix_path
Created September 30, 2019 04:10
sh: Generate the appropriate contents of CMAKE_PREFIX_PATH for the loaded set of modules.
#!/usr/bin/env bash
# Generate the appropriate contents of CMAKE_PREFIX_PATH for the loaded set of modules.
# Author: S. Mutch (2019)
#
# Usage:
# CMAKE_PREFIX_PATH=`cmake_prefix_path` cmake ..
cmake_prefix_path=""
@smutch
smutch / test.py
Created September 24, 2019 08:45
py: test swift grid writing
import numpy as np
import h5py as h5
import xarray as xa
from pathlib import Path
import numba
import pytest
SNAP = 12
@smutch
smutch / cic.py
Last active August 28, 2019 00:49
py: CIC gridding
#!/usr/bin/env python
"""A faster-than-pure-python+numpy cloud-in-cell gridding implementation.
**THIS IS A WORK IN PROGRESS AND NOT FULLY TESTED.**
Several assumptions are made:
1. All particles have the same mass (weight)
2. The volume being gridded is an N-dimensional cartesian
@smutch
smutch / calculate_rates.py
Created June 7, 2019 18:35
py: photo ionisation and heating rates for given UV spectral slope
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Calculate photo ionisation and photo heating rates for J21 = 1.0 and a given
UV spectral slope value, α.
Sorry for the current lack of comments!
"""
__author__ = "Simon Mutch"
@smutch
smutch / meraxes-on-raijin.md
Last active July 21, 2020 01:20
Running Meraxes on Raijin with a new input sim

Meraxes on Raijin

Tested with the following modules:

- Package -----------------------------+- Versions -+- Last mod. ------
gcc/4.9.0                                            2014/07/03  4:40:12
openmpi/4.0.0                                        2019/01/30  4:13:57
cmake/3.14.4                                         2019/05/16 23:37:18
gsl/2.5 2018/06/21 0:53:02
@smutch
smutch / monitor_memory.py
Created July 6, 2018 09:53
Monitor the total memory of a process and its children
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from subprocess import run, PIPE
import os
from time import sleep
import click
@click.command()
@smutch
smutch / meraxes-ozstar_notes.md
Last active June 4, 2018 07:57
Meraxes on OzStar configuration notes

With updates to the modules on OzStar, we have to be careful with the modules setup and the flags we pass to Meraxes...

First off - make a copy of you module list so you can return to it if things go wrong:

module -t list >& $HOME/old_modules.txt

then purge your modules and set the purged state to be your default:

@smutch
smutch / hdf5_compression.c
Created March 18, 2018 23:10
c:hdf5 compression test code
#include <stdio.h>
#include <hdf5.h>
#include <stdlib.h>
#include <hdf5_hl.h>
#include <math.h>
int main() {
uint dim = 512;
uint n_cell = (uint)pow(512, 3);
double fill_frac = 0.6;
@smutch
smutch / Makefile
Created February 5, 2018 06:35
make: Simple makefile to run a standard cmake build
.PHONY: default config cleanbuild
default: build/Makefile
@make -C build --no-print-directory $(MFLAGS)
config:
@cmake . -Bbuild $(CMAKE_OPTS)
cleanbuild:
@rm -r build