Skip to content

Instantly share code, notes, and snippets.

@bloyl
Created December 21, 2018 15:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bloyl/89fa7cb051aff385298f9fdd1533a8ac to your computer and use it in GitHub Desktop.
Save bloyl/89fa7cb051aff385298f9fdd1533a8ac to your computer and use it in GitHub Desktop.
name: hnn
channels:
- defaults
dependencies:
- python>=3.6
- pip
- numpy
- scipy
- matplotlib
- cython
- pyqt
- pyqtgraph
- pyopengl
- libtool=2.4.6
- pip:
- mpi4py
#!/usr/bin/env bash
# get install prefrix from cmd line
if test "$#" -ne 1; then
echo "please specify an install prefix as argument"
exit 1
fi
# expand provided path
if [[ ! "$1" =~ ^/ ]]
then
install_prefix="$PWD/$1"
else
install_prefix="$1"
fi
echo "Installing hnn, iv and nrn into $install_prefix"
# check system dependencies.
# TODO: What else should be checked for
# check that mpicc is on the path
if ! type -P mpicc &>/dev/null; then
echo "mpicc is not in\$PATH"
echo "Please install it and add to the PATH environment variable"
exit 1
fi
# TODO check python dependencies
# begin install
startdir=$(pwd)
echo $startdir
# download packages
git clone https://github.com/jonescompneurolab/hnn.git
git clone https://github.com/neuronsimulator/nrn
git clone https://github.com/neuronsimulator/iv
# build, configure and install iv
cd iv
git checkout d4bb059
./build.sh
./configure --prefix=${install_prefix}
make -j4
make install -j4
# build, configure and install nrn
cd ../nrn
#git checkout be2997e
./build.sh
./configure --with-nrnpython=python3 --with-paranrn --with-iv=${install_prefix} --prefix=${install_prefix}
make -j4
make install -j4
cd src/nrnpython
python3 setup.py install
# cleanup the nrn and iv folders, since NEURON Has been installed
cd $startdir
rm -rf iv
rm -rf nrn
# setup HNN itself
cd hnn
# make compiles the mod files
export CPU=$(uname -m)
export PATH=$PATH:${install_prefix}/$CPU/bin
make
cd ..
# delete the installed hnn folder in the event that it already exists
rm -rf ${install_prefix}/hnn
# move the hnn folder to the programs directory
cp -r hnn ${install_prefix}
# make the program accessable via the terminal command 'hnn'
ln -fs ${install_prefix}/hnn/hnn ${install_prefix}/${CPU}/bin/hnn
# useful environment variables
env_setup_fname=${install_prefix}/hnn_profile.sh
echo '# these lines define global session variables for HNN' | tee -a ${env_setup_fname}
echo 'export CPU=$(uname -m)' | tee -a ${env_setup_fname}
echo "install_prefix=${install_prefix}" | tee -a ${env_setup_fname}
echo 'source activate hnn' | tee -a ${env_setup_fname}
echo 'export PATH=$PATH:${install_prefix}/$CPU/bin' | tee -a ${env_setup_fname}
echo 'export HNN_ROOT=${install_prefix}/hnn' | tee -a ${env_setup_fname}
# and to users bashrc
# add to system profile.d
# ask for sudo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment