Colton Bukowsky
2018-08-17 03:56:28 UTC
A quick request of Christopher Hogan, would you be able to provide an
up-to-date guile package through your channel? I am relying on the channel
'tsnyder' right now, and it looks abandoned.
I thought this would be the best place to share this script. It took me a
while to get this working, but with GNU compilers it looks like one can
install MEEP, contained to an Anaconda Python environment. The motivation
for this was to not require sudo access for any part of the installation.
Not included in the script, you will need an Anaconda environment and your
preferred version of gcc. I used gcc-7 in order to be able to target the
latest Intel skylake optimizations. If you are unfamiliar with these, don't
uncomment the specified lines. I saved this as "gnucompile_MEEP.sh" in my
home directory. Compiled on Ubuntu 16.04. Good Luck!
___________SCRIPT BELOW__________
#!/bin/bash
# ***@caltech.edu Aug 2018
# This might not be the easiest way to compile a system specific MEEP
installation isolated in
# an anaconda environment. I imagine that some parts are incorrect or
redundant, but
# all tests and checks pass as of Aug 1, 2018.
# This uses the mkl libraries from intel, which are default with the
anaconda packages -- one might get better performance using intel's conda
channel
# This would be done by using '-c intel' when installing and the descending
precedence of channels
set -e # set the script to fail completely if a command has an error
# Hard coding the number of cpus to use; this might be different if you
don't have more than 4 cores or would like to use more.
export NPROCS=4
# Pass the environment name as the only argument to the script
# For a fresh installation, you'll want to run
# ***@local $~ gnucompile_MEEP.sh mycompiledMEEPenv -rcenv
# If you only want to compile (or re-compile after updates, hence '-rcXXX'
prefix) portions of the suite into an existing conda environment
# you can pass the options below, e.g. to only compile h5py and meep from
source:
# `gnucompile_MEEP.sh mycompiledMEEPenv -rch5py -rcmeep`
RCHDF5=false
RCOPENMPI=false
RCH5PY=false
RCMPI4PY=false
RCGSL=false
RCENV=false
RCFFTW=false
RCH5UTILS=false
RCHARMINV=false
RCLIBCTL=false
RCMPB=false
RCMEEP=false
RCMEEPALL=false
RUNFINALTESTS=true
export SRCBUILDDIR="${HOME}/gnu_src_build"
COMPILERS="gnu"
export CONDATRGTENV="compiledMEEP"
while [ -n "$1" ];
do
case "$1" in
-rchdf5) RCHDF5=true;
RCH5PY=true;;
-rch5py) RCH5PY=true;;
-rcopenmpi) RCOPENMPI=true;;
-rcmpi4py) RCMPI4PY=true;;
-rcgsl) RCGSL=true;;
-rcenv) RCENV=true;
RCOPENMPI=true;
RCHDF5=true;
RCH5PY=true;
RCMPI4PY=true;
RCFFTW=true;
RCGSL=true;
RCHARCMINV=true;
RCLIBCTL=true;
RCH5UTILS=true;
RCMPB=true;
RCMEEP=true;;
-source-dir) export SRCBUILDDIR=$2;
shift;;
-n) export CONDATRGTENV=$2;
shift;;
-j) export NPROCS=$2;
shift;;
-rcfftw) RCFFTW=true;;
-rcharminv) RCHARMINV=true;;
-rclibctl) RCLIBCTL=true;;
-rch5utils) RCH5UTILS=true;;
-rcmpb) RCMPB=true;;
-rcmeep) RCMEEP=true;;
-rcmeep-all) RCENV=false;
RCHARCMINV=true;
RCLIBCTL=true;
RCH5UTILS=true;
RCMPB=true;
RCMEEP=true;;
-no-final-tests) RUNFINALTESTS=false;;
-rcall) RCOPENMPI=true;
RCHDF5=true;
RCGSL=true;
RCMPI4PY=true;
RCH5PY=true;
RCFFTW=true;
RCHARCMINV=true;
RCLIBCTL=true;
RCH5UTILS=true;
RCMPB=true;
RCMEEP=true;;
esac
shift
done
source $HOME/anaconda3/bin/activate base
if $RCENV;
then
conda env remove -n "$CONDATRGTENV" -y || true
conda create -n $CONDATRGTENV --override-channels -c chogan -c defaults
-c conda-forge -c tsnyder python=3.6 mkl libpng numpy scipy cython autoconf
automake libtool swig cmake libffi six guile pip setuptools jupyter ipython
ipyparallel jupyter_contrib_nbextensions PyHamcrest
jupyter_nbextensions_configurator matplotlib -y;
source $HOME/anaconda3/bin/activate $CONDATRGTENV
pip install --upgrade --ignore-installed pip
fi
source $HOME/anaconda3/bin/activate $CONDATRGTENV
MEEP_INSTALL_PATH="${HOME}/anaconda3/envs/${CONDATRGTENV}";
export MEEP_INSTALL_PATH
cd $HOME
# mpb only looks for the 64 bit lib of ffi for some reason
if ! [ -a ${MEEP_INSTALL_PATH}/lib64 ];
then
rm -rf ${MEEP_INSTALL_PATH}/lib64 || mkdir -p ${MEEP_INSTALL_PATH}/lib64
ln -s ${MEEP_INSTALL_PATH}/lib ${MEEP_INSTALL_PATH}/lib64;
fi
mkdir -p $SRCBUILDDIR
cd $SRCBUILDDIR
export PATH="${MEEP_INSTALL_PATH}/bin:${HOME}/bin:/bin:/usr/bin"
export
LIBRARY_PATH="${MEEP_INSTALL_PATH}/lib:${MEEP_INSTALL_PATH}/lib64:${MEEP_INSTALL_PATH}/lib/openmpi"
export LD_LIBRARY_PATH="${LIBRARY_PATH}:$MEEP_INSTALL_PATH/lib"
export LD_RUN_PATH="${LIBRARY_PATH}:$MEEP_INSTALL_PATH/lib"
# Linkers and Compilers
export CC=gcc
export CXX=g++
export F77=gfortran
export F9X=$F77
export FC=$F77
# Uncomment exports below to use gcc version X if you have it installed,
give the path to it, or just gcc-X if it is installed system wide
# On Ubuntu 16.04, if you have sudo access, it is as easy as:
# sudo apt install --install-recommends --install-suggests gfortran-7 gcc-7
g++-7 -y
# sudo apt install --install-recommends --install-suggests gcc-7
# export CC=gcc-7
# export CXX=g++-7
export F77=gfortran-7
export MPICC=${MEEP_INSTALL_PATH}/bin/mpicc
export MPICXX=${MEEP_INSTALL_PATH}/bin/mpic++
# Flags
export CFLAGS="-O3 -m64 -march=native -mtune=native"
export FFLAGS="-O3 -fPIC -m64 -march=native -mtune=native"
# Uncomment exports below to use "skylake" (or another architecture) and
other gcc optimizations,see
# https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
# export CFLAGS="-O3 -m64 -march=skylake -mtune=skylake -mavx2 -msse4.2
-ftree-vectorize -pipe"
# export FFLAGS="-O3 -fPIC -m64 -march=skylake -mtune=skylake -mavx2
-msse4.2 -ftree-vectorize -pipe"
export FCFLAGS=$FFLAGS
export CXXFLAGS=$CLFAGS
export
CPATH="$CPATH:${MEEP_INSTALL_PATH}/include:${MEEP_INSTALL_PATH}/include/gsl:${MEEP_INSTALL_PATH}/lib/python3.6/site-packages/mpi4py/include:${MEEP_INSTALL_PATH}/lib/python3.6/site-packages/numpy/core/include/numpy"
if $RCOPENMPI;
then
printf
"\n\n=========================COMPILE_OPENMPI===========================\n"
cd $SRCBUILDDIR
wget
https://download.open-mpi.org/release/open-mpi/v2.1/openmpi-2.1.1.tar.gz
rm -rf openmpi-2.1.1
tar xvf openmpi-2.1.1.tar.gz
cd openmpi-2.1.1/
./configure --help
./configure --prefix="${MEEP_INSTALL_PATH}" --enable-shared
make -j $NPROCS
make -k -j $NPROCS check
make -j $NPROCS install
fi
# Have to compile HDF5-parallel first without other options
export CC=$MPICC
export CXX=$MPICXX
export FC=mpifort
export F77=mpifort
export F9X=mpifort
if $RCHDF5;
then
printf
"\n\n=========================COMPILE_HDF5-PARALLEL=====================\n"
cd $SRCBUILDDIR
wget http://www.zlib.net/zlib-1.2.11.tar.gz
rm -r zlib-1.2.11 && tar -zxvf zlib-1.2.11.tar.gz || tar -zxvf
zlib-1.2.11.tar.gz
rm zlib-1.2.11.tar.gz
cd zlib-1.2.11
CFLAGS="$CFLAGS -Werror" ./configure --prefix=${SRCBUILDDIR}/zlib-1.2.11
make
make check
make install
export RUNSERIAL="mpirun -np 1"
export RUNPARALLEL="mpirun -n ${NPROCS}"
export I_MPI_SHM_LMT=shm
cd $SRCBUILDDIR
rm -rf hdf5
git clone https://bitbucket.hdfgroup.org/scm/hdffv/hdf5.git
cd hdf5/
git checkout tags/hdf5-1_10_2
./configure --enable-parallel --enable-shared
--prefix="${MEEP_INSTALL_PATH}" --enable-static --enable-fortran --enable-hl
make -j $NPROCS
# make -k -j $NPROCS check | tee HDF5_FULL_TESTS_AUG72018.log
make -j $NPROCS install
fi
# Link/Include Paths
export GSL_ROOT_DIR=${MEEP_INSTALL_PATH}
export GSL_CBLAS_LIBRARY=${MEEP_INSTALL_PATH}/lib
MKLLIBS="-Wl,--no-as-needed,-L${MEEP_INSTALL_PATH}/lib -lmkl_rt -lpthread
-ldl"
export
CPATH="${MEEP_INSTALL_PATH}/lib/python3.6/site-packages/mpi4py/include:${MEEP_INSTALL_PATH}/lib/python3.6/site-packages/numpy/core/include/numpy:${MEEP_INSTALL_PATH}/include:${MEEP_INSTALL_PATH}/include/gsl:"
RPATH_FLAGS="-Wl,-rpath,${MEEP_INSTALL_PATH}/lib:${MEEP_INSTALL_PATH}/lib/openmpi"
export LDFLAGS="${MKLLIBS} -L${MEEP_INSTALL_PATH}/lib ${RPATH_FLAGS}"
export CPPFLAGS="-I${MEEP_INSTALL_PATH}/include"
export HDF5_MPI="ON"
if $RCGSL;
then
printf
"\n\n=========================COMPILE_GSL============================\n"
cd $SRCBUILDDIR
wget ftp://ftp.gnu.org/gnu/gsl/gsl-2.5.tar.gz
rm -rf gsl-2.5 && tar -zxvf gsl-2.5.tar.gz || tar -zxvf gsl-2.5.tar.gz
rm gsl-2.5.tar.gz
cd gsl-2.5
./configure --prefix="$MEEP_INSTALL_PATH" --enable-shared
make clean
make --jobs=$NPROCS
# make -k -j 4 check
make install prefix="$MEEP_INSTALL_PATH"
printf
"\n\n===========================DONE====================================\n";
fi
if $RCMPI4PY;
then
printf
"\n\n=========================MPI4PY=================================\n"
pip install --force-reinstall --no-deps --ignore-installed --no-cache-dir
--no-binary=mpi4py mpi4py
fi
if $RCH5PY || $RCHDF5;
then
printf
"\n\n=========================H5PY===================================\n"
cd $SRCBUILDDIR/hdf5-1.10.2;
CC=mpicc CXX=mpic++ pip install --force-reinstall --no-deps
--ignore-installed --no-cache-dir --no-binary=h5py h5py
fi
if $RCFFTW;
then
printf
"\n\n=========================COMPILE_FFTW3==========================\n"
cd $SRCBUILDDIR
rm -rf fftw-3.3.8
wget http://www.fftw.org/fftw-3.3.8.tar.gz
tar -xzf fftw-3.3.8.tar.gz
cd fftw-3.3.8
./configure --prefix=$MEEP_INSTALL_PATH \
LDFLAGS="-lmpi $MKLLIBS" \
--enable-shared --disable-static \
--enable-mpi
make -j $NPROCS
make install
printf
"\n\n===========================DONE====================================\n";
fi
export LDFLAGS="${MKLLIBS} ${RPATH_FLAGS} -lfftw3_mpi"
# Didn't test this portion; it is not required, but this should work
# printf
"\n\n=========================NLOPT===================================\n"
# cd $SRCBUILDDIR
# git clone https://github.com/stevengj/nlopt.git && cd nlopt && mkdir
build || cd nlopt
# cd build
# cmake -DCMAKE_INSTALL_PREFIX=${MEEP_INSTALL_PATH}
# make
# make test
# make install
if $RCHARMINV;
then
printf
"\n\n=========================HARMINV=================================\n"
cd $SRCBUILDDIR
rm -rf harminv
git clone https://github.com/stevengj/harminv.git && cd harminv || cd
harminv
sh autogen.sh --prefix="${MEEP_INSTALL_PATH}" \
--enable-shared --disable-static
make -j $NPROCS
make -j $NPROCS check
make install
cd ..
printf
"\n\n===========================DONE====================================\n";
fi
if $RCLIBCTL;
then
printf
"\n\n=========================LIBCTL==================================\n"
cd $SRCBUILDDIR
rm -rf libctl
git clone https://github.com/stevengj/libctl.git && cd libctl || cd libctl
sh autogen.sh --prefix="${MEEP_INSTALL_PATH}" \
--enable-shared --disable-static
make -j $NPROCS
make -j $NPROCS check
make install
cd ..
printf
"\n\n===========================DONE====================================\n";
fi
if $RCH5UTILS;
then
printf
"\n\n=========================H5UTILS=================================\n"
cd $SRCBUILDDIR
rm -rf h5utils
git clone https://github.com/stevengj/h5utils.git && cd h5utils || cd
h5utils
sh autogen.sh --prefix="${MEEP_INSTALL_PATH}" \
--enable-shared
make -j $NPROCS
make install
cd ..
printf
"\n\n===========================DONE====================================\n";
fi
if $RCMPB;
then
printf
"\n\n=========================MPB====================================\n"
cd $SRCBUILDDIR
rm -rf mpb mpb-mpi
git clone https://github.com/stevengj/mpb.git && cd mpb || cd mpb
sh autogen.sh --prefix="${MEEP_INSTALL_PATH}" \
CC=$MPICC CXX=$MPICXX \
--enable-shared --disable-static --with-hermitian-eps \
--with-lapack="$MKLLIBS" --with-blas="$MKLLIBS" \
--with-libctl="${MEEP_INSTALL_PATH}/share/libctl"
make clean && make src -j $NPROCS|| make src -j $NPROCS
make check -j $NPROCS
make install
printf
"\n\n===========================DONE====================================\n";
fi
if $RCMEEP;
then
printf
"\n\n===========================MEEP==================================\n"
cd $SRCBUILDDIR
rm -rf meep
git clone https://github.com/stevengj/meep.git && cd meep || cd meep
sh autogen.sh --prefix="${MEEP_INSTALL_PATH}" \
CC=$MPICC CXX=$MPICXX \
--enable-shared --disable-static \
PYTHON=python3 --with-mpi \
--with-lapack="$MKLLIBS" --with-blas="$MKLLIBS" \
--with-libctl="${MEEP_INSTALL_PATH}/share/libctl"
make clean && make -j $NPROCS|| make -j $NPROCS
make -k check -j 2
make install
printf
"\n\n===========================DONE====================================\n";
fi
# I have a separate script that just runs all the python tests in the MEEP
source, in order to time it. I have it commented out here, because I am not
including it.
# if $RUNFINALTESTS;
# then
# printf "\n\n===========================PYTHON
TESTS==========================\n"
# python -m h5py
# time ~/bin/meep_timing.sh -n $CONDATRGTENV -j $NPROCS
# cd ~/PycharmProjects/MEEPlearning/
# # ~/PycharmProjects/MEEPlearning/run_oled.sh $NPROCS;
# fi
up-to-date guile package through your channel? I am relying on the channel
'tsnyder' right now, and it looks abandoned.
I thought this would be the best place to share this script. It took me a
while to get this working, but with GNU compilers it looks like one can
install MEEP, contained to an Anaconda Python environment. The motivation
for this was to not require sudo access for any part of the installation.
Not included in the script, you will need an Anaconda environment and your
preferred version of gcc. I used gcc-7 in order to be able to target the
latest Intel skylake optimizations. If you are unfamiliar with these, don't
uncomment the specified lines. I saved this as "gnucompile_MEEP.sh" in my
home directory. Compiled on Ubuntu 16.04. Good Luck!
___________SCRIPT BELOW__________
#!/bin/bash
# ***@caltech.edu Aug 2018
# This might not be the easiest way to compile a system specific MEEP
installation isolated in
# an anaconda environment. I imagine that some parts are incorrect or
redundant, but
# all tests and checks pass as of Aug 1, 2018.
# This uses the mkl libraries from intel, which are default with the
anaconda packages -- one might get better performance using intel's conda
channel
# This would be done by using '-c intel' when installing and the descending
precedence of channels
set -e # set the script to fail completely if a command has an error
# Hard coding the number of cpus to use; this might be different if you
don't have more than 4 cores or would like to use more.
export NPROCS=4
# Pass the environment name as the only argument to the script
# For a fresh installation, you'll want to run
# ***@local $~ gnucompile_MEEP.sh mycompiledMEEPenv -rcenv
# If you only want to compile (or re-compile after updates, hence '-rcXXX'
prefix) portions of the suite into an existing conda environment
# you can pass the options below, e.g. to only compile h5py and meep from
source:
# `gnucompile_MEEP.sh mycompiledMEEPenv -rch5py -rcmeep`
RCHDF5=false
RCOPENMPI=false
RCH5PY=false
RCMPI4PY=false
RCGSL=false
RCENV=false
RCFFTW=false
RCH5UTILS=false
RCHARMINV=false
RCLIBCTL=false
RCMPB=false
RCMEEP=false
RCMEEPALL=false
RUNFINALTESTS=true
export SRCBUILDDIR="${HOME}/gnu_src_build"
COMPILERS="gnu"
export CONDATRGTENV="compiledMEEP"
while [ -n "$1" ];
do
case "$1" in
-rchdf5) RCHDF5=true;
RCH5PY=true;;
-rch5py) RCH5PY=true;;
-rcopenmpi) RCOPENMPI=true;;
-rcmpi4py) RCMPI4PY=true;;
-rcgsl) RCGSL=true;;
-rcenv) RCENV=true;
RCOPENMPI=true;
RCHDF5=true;
RCH5PY=true;
RCMPI4PY=true;
RCFFTW=true;
RCGSL=true;
RCHARCMINV=true;
RCLIBCTL=true;
RCH5UTILS=true;
RCMPB=true;
RCMEEP=true;;
-source-dir) export SRCBUILDDIR=$2;
shift;;
-n) export CONDATRGTENV=$2;
shift;;
-j) export NPROCS=$2;
shift;;
-rcfftw) RCFFTW=true;;
-rcharminv) RCHARMINV=true;;
-rclibctl) RCLIBCTL=true;;
-rch5utils) RCH5UTILS=true;;
-rcmpb) RCMPB=true;;
-rcmeep) RCMEEP=true;;
-rcmeep-all) RCENV=false;
RCHARCMINV=true;
RCLIBCTL=true;
RCH5UTILS=true;
RCMPB=true;
RCMEEP=true;;
-no-final-tests) RUNFINALTESTS=false;;
-rcall) RCOPENMPI=true;
RCHDF5=true;
RCGSL=true;
RCMPI4PY=true;
RCH5PY=true;
RCFFTW=true;
RCHARCMINV=true;
RCLIBCTL=true;
RCH5UTILS=true;
RCMPB=true;
RCMEEP=true;;
esac
shift
done
source $HOME/anaconda3/bin/activate base
if $RCENV;
then
conda env remove -n "$CONDATRGTENV" -y || true
conda create -n $CONDATRGTENV --override-channels -c chogan -c defaults
-c conda-forge -c tsnyder python=3.6 mkl libpng numpy scipy cython autoconf
automake libtool swig cmake libffi six guile pip setuptools jupyter ipython
ipyparallel jupyter_contrib_nbextensions PyHamcrest
jupyter_nbextensions_configurator matplotlib -y;
source $HOME/anaconda3/bin/activate $CONDATRGTENV
pip install --upgrade --ignore-installed pip
fi
source $HOME/anaconda3/bin/activate $CONDATRGTENV
MEEP_INSTALL_PATH="${HOME}/anaconda3/envs/${CONDATRGTENV}";
export MEEP_INSTALL_PATH
cd $HOME
# mpb only looks for the 64 bit lib of ffi for some reason
if ! [ -a ${MEEP_INSTALL_PATH}/lib64 ];
then
rm -rf ${MEEP_INSTALL_PATH}/lib64 || mkdir -p ${MEEP_INSTALL_PATH}/lib64
ln -s ${MEEP_INSTALL_PATH}/lib ${MEEP_INSTALL_PATH}/lib64;
fi
mkdir -p $SRCBUILDDIR
cd $SRCBUILDDIR
export PATH="${MEEP_INSTALL_PATH}/bin:${HOME}/bin:/bin:/usr/bin"
export
LIBRARY_PATH="${MEEP_INSTALL_PATH}/lib:${MEEP_INSTALL_PATH}/lib64:${MEEP_INSTALL_PATH}/lib/openmpi"
export LD_LIBRARY_PATH="${LIBRARY_PATH}:$MEEP_INSTALL_PATH/lib"
export LD_RUN_PATH="${LIBRARY_PATH}:$MEEP_INSTALL_PATH/lib"
# Linkers and Compilers
export CC=gcc
export CXX=g++
export F77=gfortran
export F9X=$F77
export FC=$F77
# Uncomment exports below to use gcc version X if you have it installed,
give the path to it, or just gcc-X if it is installed system wide
# On Ubuntu 16.04, if you have sudo access, it is as easy as:
# sudo apt install --install-recommends --install-suggests gfortran-7 gcc-7
g++-7 -y
# sudo apt install --install-recommends --install-suggests gcc-7
# export CC=gcc-7
# export CXX=g++-7
export F77=gfortran-7
export MPICC=${MEEP_INSTALL_PATH}/bin/mpicc
export MPICXX=${MEEP_INSTALL_PATH}/bin/mpic++
# Flags
export CFLAGS="-O3 -m64 -march=native -mtune=native"
export FFLAGS="-O3 -fPIC -m64 -march=native -mtune=native"
# Uncomment exports below to use "skylake" (or another architecture) and
other gcc optimizations,see
# https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html
# export CFLAGS="-O3 -m64 -march=skylake -mtune=skylake -mavx2 -msse4.2
-ftree-vectorize -pipe"
# export FFLAGS="-O3 -fPIC -m64 -march=skylake -mtune=skylake -mavx2
-msse4.2 -ftree-vectorize -pipe"
export FCFLAGS=$FFLAGS
export CXXFLAGS=$CLFAGS
export
CPATH="$CPATH:${MEEP_INSTALL_PATH}/include:${MEEP_INSTALL_PATH}/include/gsl:${MEEP_INSTALL_PATH}/lib/python3.6/site-packages/mpi4py/include:${MEEP_INSTALL_PATH}/lib/python3.6/site-packages/numpy/core/include/numpy"
if $RCOPENMPI;
then
printf
"\n\n=========================COMPILE_OPENMPI===========================\n"
cd $SRCBUILDDIR
wget
https://download.open-mpi.org/release/open-mpi/v2.1/openmpi-2.1.1.tar.gz
rm -rf openmpi-2.1.1
tar xvf openmpi-2.1.1.tar.gz
cd openmpi-2.1.1/
./configure --help
./configure --prefix="${MEEP_INSTALL_PATH}" --enable-shared
make -j $NPROCS
make -k -j $NPROCS check
make -j $NPROCS install
fi
# Have to compile HDF5-parallel first without other options
export CC=$MPICC
export CXX=$MPICXX
export FC=mpifort
export F77=mpifort
export F9X=mpifort
if $RCHDF5;
then
printf
"\n\n=========================COMPILE_HDF5-PARALLEL=====================\n"
cd $SRCBUILDDIR
wget http://www.zlib.net/zlib-1.2.11.tar.gz
rm -r zlib-1.2.11 && tar -zxvf zlib-1.2.11.tar.gz || tar -zxvf
zlib-1.2.11.tar.gz
rm zlib-1.2.11.tar.gz
cd zlib-1.2.11
CFLAGS="$CFLAGS -Werror" ./configure --prefix=${SRCBUILDDIR}/zlib-1.2.11
make
make check
make install
export RUNSERIAL="mpirun -np 1"
export RUNPARALLEL="mpirun -n ${NPROCS}"
export I_MPI_SHM_LMT=shm
cd $SRCBUILDDIR
rm -rf hdf5
git clone https://bitbucket.hdfgroup.org/scm/hdffv/hdf5.git
cd hdf5/
git checkout tags/hdf5-1_10_2
./configure --enable-parallel --enable-shared
--prefix="${MEEP_INSTALL_PATH}" --enable-static --enable-fortran --enable-hl
make -j $NPROCS
# make -k -j $NPROCS check | tee HDF5_FULL_TESTS_AUG72018.log
make -j $NPROCS install
fi
# Link/Include Paths
export GSL_ROOT_DIR=${MEEP_INSTALL_PATH}
export GSL_CBLAS_LIBRARY=${MEEP_INSTALL_PATH}/lib
MKLLIBS="-Wl,--no-as-needed,-L${MEEP_INSTALL_PATH}/lib -lmkl_rt -lpthread
-ldl"
export
CPATH="${MEEP_INSTALL_PATH}/lib/python3.6/site-packages/mpi4py/include:${MEEP_INSTALL_PATH}/lib/python3.6/site-packages/numpy/core/include/numpy:${MEEP_INSTALL_PATH}/include:${MEEP_INSTALL_PATH}/include/gsl:"
RPATH_FLAGS="-Wl,-rpath,${MEEP_INSTALL_PATH}/lib:${MEEP_INSTALL_PATH}/lib/openmpi"
export LDFLAGS="${MKLLIBS} -L${MEEP_INSTALL_PATH}/lib ${RPATH_FLAGS}"
export CPPFLAGS="-I${MEEP_INSTALL_PATH}/include"
export HDF5_MPI="ON"
if $RCGSL;
then
printf
"\n\n=========================COMPILE_GSL============================\n"
cd $SRCBUILDDIR
wget ftp://ftp.gnu.org/gnu/gsl/gsl-2.5.tar.gz
rm -rf gsl-2.5 && tar -zxvf gsl-2.5.tar.gz || tar -zxvf gsl-2.5.tar.gz
rm gsl-2.5.tar.gz
cd gsl-2.5
./configure --prefix="$MEEP_INSTALL_PATH" --enable-shared
make clean
make --jobs=$NPROCS
# make -k -j 4 check
make install prefix="$MEEP_INSTALL_PATH"
printf
"\n\n===========================DONE====================================\n";
fi
if $RCMPI4PY;
then
printf
"\n\n=========================MPI4PY=================================\n"
pip install --force-reinstall --no-deps --ignore-installed --no-cache-dir
--no-binary=mpi4py mpi4py
fi
if $RCH5PY || $RCHDF5;
then
printf
"\n\n=========================H5PY===================================\n"
cd $SRCBUILDDIR/hdf5-1.10.2;
CC=mpicc CXX=mpic++ pip install --force-reinstall --no-deps
--ignore-installed --no-cache-dir --no-binary=h5py h5py
fi
if $RCFFTW;
then
printf
"\n\n=========================COMPILE_FFTW3==========================\n"
cd $SRCBUILDDIR
rm -rf fftw-3.3.8
wget http://www.fftw.org/fftw-3.3.8.tar.gz
tar -xzf fftw-3.3.8.tar.gz
cd fftw-3.3.8
./configure --prefix=$MEEP_INSTALL_PATH \
LDFLAGS="-lmpi $MKLLIBS" \
--enable-shared --disable-static \
--enable-mpi
make -j $NPROCS
make install
printf
"\n\n===========================DONE====================================\n";
fi
export LDFLAGS="${MKLLIBS} ${RPATH_FLAGS} -lfftw3_mpi"
# Didn't test this portion; it is not required, but this should work
# printf
"\n\n=========================NLOPT===================================\n"
# cd $SRCBUILDDIR
# git clone https://github.com/stevengj/nlopt.git && cd nlopt && mkdir
build || cd nlopt
# cd build
# cmake -DCMAKE_INSTALL_PREFIX=${MEEP_INSTALL_PATH}
# make
# make test
# make install
if $RCHARMINV;
then
printf
"\n\n=========================HARMINV=================================\n"
cd $SRCBUILDDIR
rm -rf harminv
git clone https://github.com/stevengj/harminv.git && cd harminv || cd
harminv
sh autogen.sh --prefix="${MEEP_INSTALL_PATH}" \
--enable-shared --disable-static
make -j $NPROCS
make -j $NPROCS check
make install
cd ..
printf
"\n\n===========================DONE====================================\n";
fi
if $RCLIBCTL;
then
printf
"\n\n=========================LIBCTL==================================\n"
cd $SRCBUILDDIR
rm -rf libctl
git clone https://github.com/stevengj/libctl.git && cd libctl || cd libctl
sh autogen.sh --prefix="${MEEP_INSTALL_PATH}" \
--enable-shared --disable-static
make -j $NPROCS
make -j $NPROCS check
make install
cd ..
printf
"\n\n===========================DONE====================================\n";
fi
if $RCH5UTILS;
then
printf
"\n\n=========================H5UTILS=================================\n"
cd $SRCBUILDDIR
rm -rf h5utils
git clone https://github.com/stevengj/h5utils.git && cd h5utils || cd
h5utils
sh autogen.sh --prefix="${MEEP_INSTALL_PATH}" \
--enable-shared
make -j $NPROCS
make install
cd ..
printf
"\n\n===========================DONE====================================\n";
fi
if $RCMPB;
then
printf
"\n\n=========================MPB====================================\n"
cd $SRCBUILDDIR
rm -rf mpb mpb-mpi
git clone https://github.com/stevengj/mpb.git && cd mpb || cd mpb
sh autogen.sh --prefix="${MEEP_INSTALL_PATH}" \
CC=$MPICC CXX=$MPICXX \
--enable-shared --disable-static --with-hermitian-eps \
--with-lapack="$MKLLIBS" --with-blas="$MKLLIBS" \
--with-libctl="${MEEP_INSTALL_PATH}/share/libctl"
make clean && make src -j $NPROCS|| make src -j $NPROCS
make check -j $NPROCS
make install
printf
"\n\n===========================DONE====================================\n";
fi
if $RCMEEP;
then
printf
"\n\n===========================MEEP==================================\n"
cd $SRCBUILDDIR
rm -rf meep
git clone https://github.com/stevengj/meep.git && cd meep || cd meep
sh autogen.sh --prefix="${MEEP_INSTALL_PATH}" \
CC=$MPICC CXX=$MPICXX \
--enable-shared --disable-static \
PYTHON=python3 --with-mpi \
--with-lapack="$MKLLIBS" --with-blas="$MKLLIBS" \
--with-libctl="${MEEP_INSTALL_PATH}/share/libctl"
make clean && make -j $NPROCS|| make -j $NPROCS
make -k check -j 2
make install
printf
"\n\n===========================DONE====================================\n";
fi
# I have a separate script that just runs all the python tests in the MEEP
source, in order to time it. I have it commented out here, because I am not
including it.
# if $RUNFINALTESTS;
# then
# printf "\n\n===========================PYTHON
TESTS==========================\n"
# python -m h5py
# time ~/bin/meep_timing.sh -n $CONDATRGTENV -j $NPROCS
# cd ~/PycharmProjects/MEEPlearning/
# # ~/PycharmProjects/MEEPlearning/run_oled.sh $NPROCS;
# fi
--
Best,
Colton Bukowsky
Ph.D. Candidate, Atwater Research Group, Caltech
***@caltech.edu
o: +1-626-395-2821 | c: +1-954-559-9054
https://linkedin.com/in/cbukowsky
Best,
Colton Bukowsky
Ph.D. Candidate, Atwater Research Group, Caltech
***@caltech.edu
o: +1-626-395-2821 | c: +1-954-559-9054
https://linkedin.com/in/cbukowsky