Skip to content

Instantly share code, notes, and snippets.

View dutta-alankar's full-sized avatar
:octocat:
Yohoooo

Alankar Dutta dutta-alankar

:octocat:
Yohoooo
View GitHub Profile
@dutta-alankar
dutta-alankar / gadget4_halo_cross_match.py
Created February 1, 2026 23:42
Cross match properties across snaps in `Gadget 4` cosmo sim halos
#!/bin/python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 31 13:23:48 2026
@author: alankar.
Usage: time python tag-halos.py
"""
import numpy as np
@dutta-alankar
dutta-alankar / parallel-sort-pow-2.py
Created January 29, 2026 12:55
Parallel sorts a distributed array using MPI (works only when total processor count is 2^N)
#!/bin/python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 29 13:15:48 2026
@author: alankar.
Usage: time python parallel-sort.py
"""
from mpi4py import MPI
@dutta-alankar
dutta-alankar / parallel-sort.py
Last active January 29, 2026 12:53
Parallel sorting of a distributed array using MPI
#!/bin/python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 29 13:34:48 2026
@author: alankar.
Usage: time python parallel-sort-arb.py
"""
from mpi4py import MPI
@dutta-alankar
dutta-alankar / field-length-sim.py
Last active January 28, 2026 16:34
Field length calculation in sims
#!/bin/python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 27 11:54:48 2026
@author: alankar.
Usage: time python lF-res.py
"""
import numpy as np
@dutta-alankar
dutta-alankar / create-duplicate-xmf.py
Created January 23, 2026 08:09
Create a set of `xmf` files at a different location that can refer to the original `hdf5` files
#!/bin/python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 23 09:06:48 2026
@author: alankar.
Usage: time python create-duplicate-xmf.py <source_dir> <dest_dir> <last_file_number>
"""
import os
@dutta-alankar
dutta-alankar / mass-cold+dense-color-time.svg
Last active October 16, 2025 10:53
A plot of mass as a function of distance colored by time (see Fig. 8 from paper Fading in the Flow; MNRAS for an alternate version)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
! Use a nice truetype font and size by default...
xterm*faceName: DejaVu Sans Mono Book
xterm*faceSize: 22
! Every shell is a login shell by default (for inclusion of all necessary environment variables)
xterm*loginshell: true
! I like a LOT of scrollback...
@dutta-alankar
dutta-alankar / freya-slurm-script.sh
Created July 3, 2025 07:37
Slurm script for Freya on MPCDF
#!/bin/bash
# Standard output and error:
#SBATCH -o ./tjob.%x.out.%j
#SBATCH -e ./tjob.%x.err.%j
#SBATCH --job-name="CCtest"
#
# Number of nodes and MPI tasks per node:
#SBATCH --nodes=15
#SBATCH --ntasks-per-node=40
@dutta-alankar
dutta-alankar / stencil-demo.chpl
Created June 24, 2025 08:19
Demonstration of stencil distribution on Chapel
import StencilDist.stencilDist;
import StencilDist.boundaries;
const side_low = 1;
const side_high = -1;
config const n = 10;
config const nghost = 2;
config const periodic = false;
const Space = {1..n};
const AllSpace = Space.expand((nghost,));
@dutta-alankar
dutta-alankar / gadget4-compile-script.sh
Created June 18, 2025 11:03
Gadget4 compile command
#!/bin/bash
module purge && module load gcc/11 openmpi/4 hdf5-mpi/1.14.1 gsl/2.7 fftw-mpi/3.3.9
export LD_LIBRARY_PATH="/mpcdf/soft/SLE_15/packages/skylake/openmpi/gcc_11-11.2.0/4.0.7/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/mpcdf/soft/SLE_15/packages/skylake/gsl/gcc_11-11.2.0/2.7.1/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/mpcdf/soft/SLE_15/packages/skylake/fftw/gcc_11-11.2.0-openmpi_4-4.0.7/3.3.9/lib:$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="/mpcdf/soft/SLE_15/packages/skylake/hdf5/gcc_11-11.2.0-openmpi_4-4.0.7/1.14.1/lib:$LD_LIBRARY_PATH"
export GADGET4_DIR="/orion/ptmp/adutt/arepo-multi-zoom/gadget-files/gadget4_development"
export PROB_DIR="/orion/ptmp/adutt/arepo-multi-zoom/gadget-files/gadget4_development/examples/multi-zoom/zoom"