Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running qsub with anaconda environment

I have a program that usually runs inside a conda environmet in Linux, because I use it to manage my libraries, with this instructions:

source activate my_environment
python hello_world.py

How can I run hello_world.py in a high computer that works with PBS. Instructions explains to run adapting the code script.sh, shown below, and calling with the instruction qsub.

# script.sh
#!/bin/sh
#PBS -S /bin/sh
#PBS -N job_example
#PBS -l select=24
#PBS -j oe
cd $PBS_O_WORKDIR
mpiexec ./programa_mpi

How do I run hello_world.py with qsub using my anaconda environment?

like image 980
Ushuaia81 Avatar asked Nov 16 '18 22:11

Ushuaia81


1 Answers

Unless it is in the environment by default, one also needs to "load" conda as well, inside the SGE(qsub) script (similar thing would hold for a slurm script too I assume). For example I had installed conda to the directory seen below in the SGE script, so I export the path (if conda is installed as a module on an HPCC, then simply load that instead):

#!/bin/bash
#$ -q compute
#$ -l compute
#$ -cwd
#$ -N name
#$ -j yes

export PATH=$HOME/miniconda3/bin:$PATH

source activate my_environment

environment function code...
like image 168
FatihSarigol Avatar answered Sep 21 '22 01:09

FatihSarigol