Skip to content

Instantly share code, notes, and snippets.

View smartalecH's full-sized avatar

Alec Hammond smartalecH

  • Meta Reality Labs Research
  • Redmond, WA
View GitHub Profile
@smartalecH
smartalecH / README.md
Created August 1, 2018 20:04 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@smartalecH
smartalecH / Py_SLURM_param_sweeper.md
Created October 19, 2018 15:24 — forked from TysonRayJones/Py_SLURM_param_sweeper.md
Guide to using the python script for generating param-sweeping SLURM submission scripts

SLURM param sweeper

Get the code here.

This python library generates SLURM submission scripts which launch multiple jobs to 'sweep' a given set of parameters; that is, a job is run for every possible configuration of the params.

For example, you might have a script which accepts parameters a, b and c, which you call (passing a=1, b=2, c=3) like

@smartalecH
smartalecH / cluster_cmds.sh
Last active April 20, 2020 18:21
Useful cluster commands
# ---------------------------------------------------- #
# BYU supercomputer
# ---------------------------------------------------- #
# Interactive jobs - use salloc
salloc --nodes=1 --ntasks-per-node=1 --time=1:00:00 --mem-per-cpu=2GB # Doesn't support GPUS for now...
# ---------------------------------------------------- #
# GaTech PACE cluster
# ---------------------------------------------------- #
@smartalecH
smartalecH / build-gcc-offload-nvptx.sh
Created August 16, 2020 16:39 — forked from matthiasdiener/build-gcc-offload-nvptx.sh
Script to build gcc with OpenMP offloading to Nvidia devices (via nvptx)
#!/bin/bash
#
# Build GCC with support for offloading to NVIDIA GPUs.
#
set -o nounset -o errexit
# Location of the installed CUDA toolkit
cuda=/usr/local/cuda
@smartalecH
smartalecH / damping_gradient.py
Created October 29, 2021 19:39
Simple script to test if the damping gradients are correct.
import meep as mp
try:
import meep.adjoint as mpa
except:
import adjoint as mpa
import numpy as np
from autograd import numpy as npa
from autograd import tensor_jacobian_product
from enum import Enum
from matplotlib import pyplot as plt
import meep as mp
try:
import meep.adjoint as mpa
except:
import adjoint as mpa
import numpy as np
from autograd import numpy as npa
from autograd import tensor_jacobian_product
from enum import Enum
from matplotlib import pyplot as plt
import meep as mp
try:
import meep.adjoint as mpa
except:
import adjoint as mpa
import numpy as np
from autograd import numpy as npa
from autograd import tensor_jacobian_product
from enum import Enum
from matplotlib import pyplot as plt
import meep as mp
import numpy as np
import matplotlib.pyplot as plt
resolution = 10
r_bank = np.linspace(1.0,1.0+1/resolution,100)
sum_bank = []
for r in r_bank:
print(r)
sim = mp.Simulation(
"""
Checks that the constraint function with constraint L applied to a circle
with diameter d has a return value based on the convention that a violation
(L > d) is >=0 and a non-violation is ~0.
"""
from typing import Tuple
import matplotlib