tAdded more torque-script generating functions - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
(HTM) git clone git://src.adamsgaard.dk/sphere
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 0ddcc847fc900cbb8998edcfc38cc3273e15782d
(DIR) parent d8cd8d4dbb475bebee247a0460b65242772505d9
(HTM) Author: Anders Damsgaard <adc@geo.au.dk>
Date: Thu, 14 Mar 2013 19:25:25 +0100
Added more torque-script generating functions
Diffstat:
M python/sphere.py | 56 ++++++++++++++++++++++++++++---
1 file changed, 52 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/python/sphere.py b/python/sphere.py
t@@ -479,7 +479,7 @@ class Spherebin:
raise Exception("Volumetric ratio seems wrong")
if (verbose == True):
- print("generateBimodalRadii created " + str(nlarge) + " large particles, and " + str(nlarge-self.np[0]) + " small")
+ print("generateBimodalRadii created " + str(nlarge) + " large particles, and " + str(self.np[0] - nlarge) + " small")
def initRandomPos(self, g = numpy.array([0.0, 0.0, -9.80665]),
t@@ -2059,7 +2059,7 @@ def run(binary, verbose=True, hideinputfile=False):
stdout = " > /dev/null"
subprocess.call("cd ..; ./sphere " + quiet + " " + binary + " " + stdout, shell=True)
-def torqueScript3(obj1, obj2, obj3,
+def torqueScriptParallel3(obj1, obj2, obj3,
email="adc@geo.au.dk",
email_alerts="ae",
walltime="24:00:00",
t@@ -2067,10 +2067,13 @@ def torqueScript3(obj1, obj2, obj3,
cudapath="/com/cuda/4.0.17/cuda",
spheredir="/home/adc/code/sphere",
workdir="/scratch"):
- '''Create job script for the Torque queue manager for three binaries
+ ''' Create job script for the Torque queue manager for three binaries,
+ executed in parallel.
+ Returns the filename of the script
'''
- filename = self.sid + ".sh"
+ filename = obj1.sid + '_' + obj2.sid + '_' + obj3.sid + '.sh'
+
fh = None
try :
fh = open(filename, "w")
t@@ -2098,6 +2101,51 @@ def torqueScript3(obj1, obj2, obj3,
fh.write('wait\n')
fh.write('cp $WORKDIR/output/* $ORIGDIR/output/\n')
fh.write('echo "End at `date`"\n')
+ return filename
+
+ finally :
+ if fh is not None:
+ fh.close()
+
+
+def torqueScriptSerial3(obj1, obj2, obj3,
+ email="adc@geo.au.dk",
+ email_alerts="ae",
+ walltime="24:00:00",
+ queue="qfermi",
+ cudapath="/com/cuda/4.0.17/cuda",
+ spheredir="/home/adc/code/sphere",
+ workdir="/scratch"):
+ '''Create job script for the Torque queue manager for three binaries
+ '''
+
+ filename = self.sid + ".sh"
+ fh = None
+ try :
+ fh = open(filename, "w")
+
+ fh.write('#!/bin/sh\n')
+ fh.write('#PBS -N ' + obj1.sid + '_' + obj2.sid + '_' + obj3.sid + '\n')
+ fh.write('#PBS -l nodes=1:ppn=1\n')
+ fh.write('#PBS -l walltime=' + walltime + '\n')
+ fh.write('#PBS -q ' + queue + '\n')
+ fh.write('#PBS -M ' + email + '\n')
+ fh.write('#PBS -m ' + email_alerts + '\n')
+ fh.write('CUDAPATH=' + cudapath + '\n')
+ fh.write('export PATH=$CUDAPATH/bin:$PATH\n')
+ fh.write('export LD_LIBRARY_PATH=$CUDAPATH/lib64:$CUDAPATH/lib:$LD_LIBRARY_PATH\n')
+ fh.write('echo "`whoami`@`hostname`"\n')
+ fh.write('echo "Start at `date`"\n')
+ fh.write('ORIGDIR=' + spheredir + '\n')
+ fh.write('WORKDIR=' + workdir + "/$PBS_JOBID\n")
+ fh.write('cp -r $ORIGDIR/* $WORKDIR\n')
+ fh.write('cd $WORKDIR\n')
+ fh.write('cmake . && make\n')
+ fh.write('./sphere input/' + obj1.sid + '.bin > /dev/null\n')
+ fh.write('./sphere input/' + obj2.sid + '.bin > /dev/null\n')
+ fh.write('./sphere input/' + obj3.sid + '.bin > /dev/null\n')
+ fh.write('cp $WORKDIR/output/* $ORIGDIR/output/\n')
+ fh.write('echo "End at `date`"\n')
finally :
if fh is not None: