amuse icon indicating copy to clipboard operation
amuse copied to clipboard

Add an Official Singularity Container

Open JPGlaser opened this issue 4 years ago • 0 comments

Hey All,

Since I transferred to my current position with the NANOGrav/WVU HPC administration team, I have been working a lot with singularity, a secure method of running software on HPC systems via containers. Unlike Docker, which has lots of security issues, singularity seems to be quite popular in its up-take at HPC centers as it doesn't allow for permission escalation within the container.

Below I have included a script which should install AMUSE on a CentOS 7 container with GPU libraries set correctly. @spzwart mentioned it would be worth adding this recipe to the AMUSE Git directory, though we could also maintain a Docker/Singularity image on external container hosting sites (like hub.docker.com).

Thoughts?

~ Joe G.

# AMUSE Container                                                   #
# =====================                                             #
#                                                                   #
# This container offers a build of AMUSE of of CentOS 7             #
# from the official Dockers containers.                             #
#                                                                   #
# singularity build centos7_amuse.simg amuse.recipe                 #
#                                                                   #
#####################################################################

Bootstrap: docker
From: centos:7

%help
  Helpful information to come. This container is running the following:
  - CentOS      7.0.0
  - HDF5        1.8.12
  - Hypre       2.11.2
  - netCDF CXX  4.2.8
  - netCDF C    4.3.3
  - netCDF F90  4.2-16
  - zlib        1.2.7
  - FLASH       4.6.2
  - OpenMPI3    3.1.3

%labels
  CREATOR Joe Glaser

%runscript
exec echo "The runscript is the containers default runtime command!"

%files

%environment
  SHELL=/bin/bash
  export SHELL
  export PATH="/usr/lib64/openmpi3/bin:/usr/local/anaconda/bin:$PATH"
  export AMUSE_DIR=/opt/amuse
  export PYTHONPATH=$PYTHONPATH:${AMUSE_DIR}/test
  export PYTHONPATH=$PYTHONPATH:${AMUSE_DIR}/src
  module load mpi

%post
  echo "The post section is where you can install, and configure your container."
# Install the EPEL Repo
  yum search epel-release
  yum info epel-release
  yum -y install epel-release
# Do an Update and Upgrade
  yum -y update
  yum -y upgrade
# Install Useful Commands
  yum -y install sudo which nano wget bzip2 git cmake \
    ca-certificates libglib2.0-0 libxext6 libsm6 libxrender1

# Install AMUSE Base Requirements
  yum -y install curl libcurl* devtoolset-8 gettext* zlib*
# Install OpenMPI3 and Append the Path Variable
  yum -y install openmpi3*
  export PATH=/usr/lib64/openmpi3/bin:$PATH
# Install HDF5 with OpenMPI3 Support
  yum -y install hdf5 hdf5-devel hdf5-openmpi3*
# Install NetCDF (No OpenMPI Support Due to Dependence on v1.10)
  yum -y install netcdf netcdf-devel \
    netcdf-cxx-devel netcdf-cxx-static netcdf-cxx \
    netcdf-fortran-devel netcdf-fortran-static netcdf-fortran
# Install FFTW
  yum -y install fftw fftw-devel fftw-libs*
# Install GSL, GMP & MPFR
  yum -y install gsl gsl-devel gmp gmp-devel mpfr mpfr-devel

# Install FLASH Requirements
  yum -y install hypre hypre-devel papi papi-devel papi-static libIDL libIDL-devel

# Install CUDA
  wget https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda-repo-rhel7-11-1-local-11.1.1_455.32.00-1.x86_64.rpm
  rpm -i cuda-repo-rhel7-11-1-local-11.1.1_455.32.00-1.x86_64.rpm
  yum clean all
  yum -y install nvidia-driver-latest-dkms cuda
  yum -y install cuda-drivers

# Install Miniconda Environment
  if [ ! -d /usr/local/anaconda ]; then
    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
      -O ~/anaconda.sh && \
      bash ~/anaconda.sh -b -p /usr/local/anaconda && \
      rm ~/anaconda.sh
  fi

# Set Anaconda Path
  export PATH="/usr/local/anaconda/bin:$PATH"

# install the bare minimum
  pip install numpy scipy astropy matplotlib
  env MPICC=/usr/lib64/openmpi3/bin/mpicc pip install mpi4py
  pip install h5py pytest docutils quilt gsl
  conda install gmp mpfr nose yt
  conda clean --tarballs

# Install AMUSE
  cd /opt
  #git clone https://github.com/amusecode/amuse.git
  wget https://github.com/amusecode/amuse/archive/v13.2.0.tar.gz
  tar -zxf v13.2.0.tar.gz
  mv amuse-13.2.0 amuse
  cd amuse
  ./configure --enable-cuda
  make
  pip install rebound

JPGlaser avatar Dec 14 '20 15:12 JPGlaser