Skip to content

Commit

Permalink
Fix slurm script
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Eilemann committed Mar 6, 2012
1 parent 12c1bdf commit f34fa95
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 35 deletions.
38 changes: 33 additions & 5 deletions scripts/gpu-sd.sbatch
@@ -1,17 +1,45 @@
#!/usr/bin/env python
import os
import slurm
import re
import sys
import threading

nodes = slurm.getNodelist()
def getNodelist():
nodelist = os.environ['SLURM_JOB_NODELIST']

p = re.compile( '[^\[]+' )
match = p.match( nodelist )
basename = match.group()

p = re.compile( '\[[0-9,\-]+\]' )
match = p.search( nodelist )

p = re.compile( '[0-9,\-]+' )
match = p.search( match.group( ))
list = match.group()

p = re.compile( '-' )
nodes = []
for i in list.split( ',' ):
match = p.search( i )
if match:
tuple = i.split( '-' )
for node in range( int( tuple[0] ), int( tuple[1] ) + 1 ):
nodes.append( '%(name)s%(num)02d' % { 'name' : basename,
'num' : node } )
else:
nodes.append( basename + i )
return nodes

def launch( command ):
os.popen( command )


nodes = getNodelist()
arguments = sys.argv
arguments[0] = 'gpu_sd'
command = ' '.join( arguments )

def launch( command ):
os.exec( command )

threads = []
for node in nodes:
launchCmd = 'ssh ' + node + ' ' + command
Expand Down
30 changes: 0 additions & 30 deletions scripts/slurm.py

This file was deleted.

0 comments on commit f34fa95

Please sign in to comment.