Last active
September 11, 2020 13:01
-
-
Save HighIander/9259f53c85c77516126bafcd3393254f to your computer and use it in GitHub Desktop.
Sample smilei files
This file contains hidden or 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
| use at your own risk! |
This file contains hidden or 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
| # >>> conda initialize >>> | |
| # put this file somewhere in your home directory and source before working with conda, i.e. before sourcing the smilie.profile! | |
| # you are adviced to auto-source it upon log-on, e.g. put "source ~/.condaInit.sh" in your .bashrc file | |
| # !! Contents within this block are managed by 'conda init' !! | |
| __conda_setup="$('/trinity/shared/pkg/devel/anaconda/2019.07/bin/conda' 'shell.bash' 'hook' 2\ | |
| > /dev/null)" | |
| if [ $? -eq 0 ]; then | |
| eval "$__conda_setup" | |
| else | |
| if [ -f "/trinity/shared/pkg/devel/anaconda/2019.07/etc/profile.d/conda.sh" ]; then | |
| . "/trinity/shared/pkg/devel/anaconda/2019.07/etc/profile.d/conda.sh" | |
| else | |
| export PATH="/trinity/shared/pkg/devel/anaconda/2019.07/bin:$PATH" | |
| fi | |
| fi | |
| unset __conda_setup | |
| # <<< conda initialize <<< |
This file contains hidden or 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
| #smilei python conda profile loader; put into the smilei profile directory to be auto-sourced by the smilei.profile | |
| #on hemera4, you have to run the .condaInit first! | |
| export PATH=$PATH:/home/kluget/picongpu-src/lib/python | |
| # anaconda | |
| export PATH="$HOME/anaconda3/bin:$PATH" | |
| conda activate base # a clean profile, without any additional packages installed | |
| conda activate --stack analysis # a profile for general python analysis stuff | |
| conda activate --stack smilei # including happi |
This file contains hidden or 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
| #!/bin/bash | |
| #Sample sbatch.sh slurm submit script for smilei, on hemera; to be called from within the input file folder by smilei-submit script | |
| #SBATCH --job-name=SmallCuLT94 | |
| #SBATCH --partition=intel # partition to be used (defq, gpu or intel) | |
| #SBATCH --time=96:00:00 # walltime (up to 96 hours) | |
| ###SBATCH --nodes=2 # number of nodes | |
| #SBATCH --ntasks=32 # number of tasks (i.e. parallel processes) to be started | |
| #SBATCH --error=stderr | |
| #SBATCH --output=stdout | |
| mpiexec -n 32 src/smilei ./input.py |
This file contains hidden or 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
| #/usr/bin/env bash | |
| #WIP! | |
| #use pic-edit to open the smilei input file in an editor and go the specified code block, this file provides autocompletion for the code blocks; put into smilei profile directory and use my smilei.profile to automatically source it | |
| _smilei-edit() | |
| { | |
| local cur names | |
| cur="${COMP_WORDS[COMP_CWORD]}" | |
| #add auto completion words here: | |
| names=$(echo "Vectorization";echo "vectorization";echo " ") | |
| names=$names$(echo "Main"; echo "main";echo " ") | |
| COMPREPLY=( $(compgen -W "${names}" -- ${cur}) ) | |
| return 0 | |
| } | |
| complete -F _smilei-edit smilei-edit |
This file contains hidden or 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
| #/usr/bin/env bash | |
| #open python input file and go to the specified code block; put path into PATH variable for convenience; put into smiley profile directory and use my smilei.profile to automatically have the dir in PATH | |
| #we assume that the input file is always called *.py and only one py file is present! | |
| #can auto complete with a number of blocks and automatically goes to the respective position in input.py | |
| #currently, the editor has to be hardcoded, i.e. emacs -nw or vim | |
| POSITION="" | |
| if [ "$1" != "" ] | |
| then | |
| searchStr=$1"(" | |
| line=$(grep -i -n $searchStr *.py) | |
| line=${line%%:*} | |
| emacs -nw +$line *.py | |
| else | |
| emacs -nw *.py | |
| fi |
This file contains hidden or 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
| #!/bin/bash | |
| #submit script for smilei; put into smilei profile directory and use my smilei.profile in order to add automatically to PATH; submit inside the case-directory e.g. via qsub smilei-submit | |
| homeDir=$(pwd) | |
| force=False | |
| verbose=False | |
| batch=0 | |
| n=1 | |
| help=False | |
| while [ "$1" != "" ]; do | |
| case $1 in | |
| -t | --target) export SIMPATH=$2 | |
| shift | |
| ;; | |
| -f | --force ) force=True | |
| ;; | |
| -s | --submitscript ) export SCRIPT=$2 | |
| shift | |
| ;; | |
| -v | --verbose ) verbose=True | |
| ;; | |
| -b | --batch ) export batch=$2 | |
| shift | |
| ;; | |
| -n | --number ) export n=$2 | |
| shift | |
| ;; | |
| -h | --help ) help=True | |
| ;; | |
| esac | |
| shift | |
| done | |
| if [ $help == True ] | |
| then | |
| echo "This script submits a Smilei simulation from the current directory" | |
| echo "Usage: submit -t <target output directory> [options]" | |
| echo "Options -s|--submitscript -f|--force -v|--verbose -h|--help:" | |
| echo "-s: location of the submit submit script. Default: ./sbatch.sh" | |
| echo "-f: force directory overwrite, if already existing" | |
| echo "-v: verbose output" | |
| echo "-b: if b>0: batch mode, starting with case b in batch.py" | |
| echo "-n: if in batch mode, specifies the number of runs starting at b. Default is 1" | |
| echo "-h: show this help" | |
| exit | |
| fi | |
| if [ -d $SIMPATH ] && [ $force == False ] | |
| then | |
| echo '[Error!] Target directory' $SIMPATH 'already exists! Aborting.' | |
| exit | |
| else | |
| if [ -d $SIMPATH ] | |
| then | |
| echo '[Warning!] Target directory' $SIMPATH 'already exists! Overwriting upon user request.' | |
| # rm -rf $SIMPATH | |
| fi | |
| if [ $batch -gt 0 ] | |
| then | |
| if [ $verbose == True ]; then echo "Copying source from $PICSRC..."; fi | |
| mkdir $SIMPATH | |
| mkdir -p $SIMPATH/src | |
| cp -r $PICSRC/* $SIMPATH/src | |
| SIMPATHorig=$SIMPATH | |
| a=$(($batch)) | |
| b=$(($batch+$n-1)) | |
| if [ $verbose == True ]; then echo "Submitting jobs in batch mode."; fi | |
| for ((i=$a; i<=$b; i++)) | |
| do | |
| if [ $verbose == True ]; then echo "---------------------------------"; fi | |
| if [ $verbose == True ]; then echo "Job $i ($(($i-$a+1)) of $(($b-$a+1))):" ; fi | |
| cd $homeDir | |
| SIMPATH="${SIMPATHorig}/${i}" | |
| mkdir $SIMPATH | |
| echo "currentSim = ${i}" > $SIMPATH/current.py | |
| if [ $verbose == True ]; then echo 'Copying input...'; fi | |
| cp ./$PICINPUT $SIMPATH | |
| cp ./$PICBATCH $SIMPATH | |
| cp ./$PICSUBMITSCRIPT $SIMPATH | |
| cd $SIMPATH | |
| sed "/$PICNAME/s/$/$i/" $PICSUBMITSCRIPT > temp.sh && mv temp.sh $PICSUBMITSCRIPT | |
| cat $PICBATCH $PICINPUT > temp && mv temp $PICINPUT | |
| cat current.py input.py >temp && mv temp $PICINPUT | |
| RES=$($PICSUBMIT $PICSUBMITSCRIPT) | |
| echo 'qdel ' ${RES##* } >> "${SIMPATHorig}"/submittedJobIDs | |
| if [ $verbose == True ] | |
| then | |
| echo "Submitted case $i using $PICSUBMITSCRIPT: ID ${RES##* }" | |
| echo 'Please wait for the job to finish! Then, look for output in:' | |
| echo ' '$SIMPATH | |
| fi | |
| done | |
| if [ $verbose == True ]; then echo "---------------------------------"; fi | |
| if [ $verbose == True ]; then echo "All job IDs can be found in ${SIMPATHorig}/submittedJobIDs"; fi | |
| else | |
| #not in batch mode | |
| mkdir -p $SIMPATH/src | |
| if [ $verbose == True ]; then echo 'Copying input and source...'; fi | |
| cp ./$PICINPUT $SIMPATH/input.py | |
| cp ./$PICSUBMITSCRIPT $SIMPATH | |
| cp -r $PICSRC/* $SIMPATH/src | |
| cd $SIMPATH | |
| if [ $verbose == True ] | |
| then | |
| module list | |
| echo "submitting job using $PICSUBMITSCRIPT ..." | |
| echo ' ' | |
| fi | |
| $PICSUBMIT $PICSUBMITSCRIPT | |
| if [ $verbose == True ] | |
| then | |
| echo 'Please wait for the job to finish!' | |
| echo 'Look for output in:' | |
| echo ' '$SIMPATH | |
| fi | |
| fi | |
| fi |
This file contains hidden or 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
| #/usr/bin/env bash | |
| #smilei profile for hemera @ hzdr | |
| #put in a profile directory together with smilei-edit and smilei-completion.sh and jupyter.profile and smilei-submit for best convenience | |
| #source .condaInit and this file before working with smilei | |
| # User Information ################################# (edit the following lines) | |
| # - automatically add your name and contact to output file meta data | |
| # - send me a mail on batch system jobs: NONE, BEGIN, END, FAIL, REQUEUE, ALL, | |
| # TIME_LIMIT, TIME_LIMIT_90, TIME_LIMIT_80 and/or TIME_LIMIT_50 | |
| export MY_MAILNOTIFY="NONE" | |
| export MY_MAIL="[email protected]" | |
| export MY_NAME="$(whoami) <$MY_MAIL>" | |
| export PICPROFILES=$HOME/smilei-profiles | |
| alias PICEDITOR="emacs -nw" | |
| module purge | |
| source $PICPROFILES/jupyter.profile | |
| module load python/3.8.0 | |
| module load intel/19.0 | |
| module load openmpi/2.1.2 | |
| module load python/3.8.0 | |
| module load zlib/1.2.11 | |
| module load hdf5-parallel/1.8.20 | |
| module load ffmpeg/4.2.1 | |
| export PICSRC=$HOME/smilei-src | |
| export PICINPUTS=$HOME/smilei-inputs | |
| export PYTHONHOME=$PYTHON3_ROOT | |
| export PATH=$PATH:$PICPROFILES | |
| # Load autocompletion for PIConGPU commands | |
| BASH_COMP_FILE=$PICPROFILES/smilei-completion.bash | |
| if [ -f $BASH_COMP_FILE ] ; then | |
| source $BASH_COMP_FILE | |
| else | |
| echo "bash completion file '$BASH_COMP_FILE' not found." >&2 | |
| fi | |
| export PICINPUT=input.py | |
| export PICBATCH=inputBatch.py | |
| export PICSUBMITSCRIPT=sbatch.sh | |
| export PICSUBMIT=sbatch | |
| # how is the name of the simulation defined in the submit script | |
| # for slurm, this is #SBATCH --job-name= | |
| # needed to append the number of the current simulation to the name in bacth mode | |
| export PICNAME='#SBATCH --job-name=' | |
| export PYTHONHOME=$PYTHON3_ROOT | |
| export PATH=$PATH:$PICPROFILES | |
| #Default threads | |
| export OMP_NUM_THREADS=1 | |
| H5PY_DEFAULT_READONLY=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment