-
-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc2c233
commit e16821c
Showing
2 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
{ stdenv | ||
, lib | ||
, buildPythonPackage | ||
, fetchFromGitHub | ||
, autoreconfHook | ||
, pkg-config | ||
, gfortran | ||
, mpi | ||
, blas | ||
, lapack | ||
, fftw | ||
, hdf5-mpi | ||
, swig | ||
, gsl | ||
, harminv | ||
, libctl | ||
, libGDSII | ||
, openssh | ||
, guile | ||
, python | ||
, numpy | ||
, scipy | ||
, matplotlib | ||
, h5py-mpi | ||
, cython | ||
, autograd | ||
, mpi4py | ||
}: | ||
|
||
buildPythonPackage rec { | ||
pname = "meep"; | ||
version = "1.25.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "NanoComp"; | ||
repo = pname; | ||
rev = "v${version}"; | ||
hash = "sha256-4rIz2RXLSWzZbRuv8d4nidOa0ULYc4QHIdaYrGu1WkI="; | ||
}; | ||
|
||
format = "other"; | ||
|
||
nativeBuildInputs = [ | ||
autoreconfHook | ||
gfortran | ||
pkg-config | ||
swig | ||
mpi | ||
]; | ||
|
||
buildInputs = [ | ||
gsl | ||
blas | ||
lapack | ||
fftw | ||
hdf5-mpi | ||
harminv | ||
libctl | ||
libGDSII | ||
guile | ||
gsl | ||
]; | ||
|
||
propagatedBuildInputs = [ | ||
mpi | ||
numpy | ||
scipy | ||
matplotlib | ||
h5py-mpi | ||
cython | ||
autograd | ||
mpi4py | ||
]; | ||
|
||
propagatedUserEnvPkgs = [ mpi ]; | ||
|
||
dontUseSetuptoolsBuild = true; | ||
dontUsePipInstall = true; | ||
dontUseSetuptoolsCheck = true; | ||
|
||
enableParallelBuilding = true; | ||
|
||
preConfigure = '' | ||
export HDF5_MPI=ON | ||
export PYTHON=${python}/bin/${python.executable}; | ||
''; | ||
|
||
configureFlags = [ | ||
"--without-libctl" | ||
"--enable-shared" | ||
"--with-mpi" | ||
"--with-openmp" | ||
"--enable-maintainer-mode" | ||
]; | ||
|
||
passthru = { inherit mpi; }; | ||
|
||
doCheck = true; | ||
checkPhase = '' | ||
export PATH=$PATH:${openssh}/bin | ||
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" | ||
export OMP_NUM_THREADS=1 | ||
# Fix to make mpich run in a sandbox | ||
export HYDRA_IFACE=lo | ||
export OMPI_MCA_rmaps_base_oversubscribe=1 | ||
# Generate a python test script | ||
cat > test.py << EOF | ||
import meep as mp | ||
cell = mp.Vector3(16,8,0) | ||
geometry = [mp.Block(mp.Vector3(mp.inf,1,mp.inf), | ||
center=mp.Vector3(), | ||
material=mp.Medium(epsilon=12))] | ||
sources = [mp.Source(mp.ContinuousSource(frequency=0.15), | ||
component=mp.Ez, | ||
center=mp.Vector3(-7,0))] | ||
pml_layers = [mp.PML(1.0)] | ||
resolution = 10 | ||
sim = mp.Simulation(cell_size=cell, | ||
boundary_layers=pml_layers, | ||
geometry=geometry, | ||
sources=sources, | ||
resolution=resolution) | ||
sim.run(until=200) | ||
EOF | ||
${mpi}/bin/mpiexec -np 2 python3 test.py | ||
''; | ||
|
||
meta = with lib; { | ||
description = "Free finite-difference time-domain (FDTD) software for electromagnetic simulations"; | ||
homepage = "https://meep.readthedocs.io/en/latest/"; | ||
license = licenses.gpl2Only; | ||
platforms = platforms.linux; | ||
maintainers = with maintainers; [ sheepforce markuskowa ]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters