Commit 27220ee2 authored by Gao, Shang's avatar Gao, Shang
Browse files

added qsub script for moldyn example

parent 1204b5ab
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@ class crossbowGlobus(crossbowBase):
        self._activate_endpoint(self.cadesdtn)

        #execute transfer
        print "uploading %s" % filename
        tdata = globus_sdk.TransferData(self.transfer, source_endpoint, self.cadesdtn,
                                    label="Crossbow Transfer", sync_level="checksum")
        tdata.add_item(resource_path,'/data/cades-crossbow/'+package+'/'+filename)
@@ -254,6 +255,7 @@ class crossbowGlobus(crossbowBase):
        self._activate_endpoint(self.cadesdtn)

        #execute transfer
        print "downloading %s" % resource
        tdata = globus_sdk.TransferData(self.transfer, self.cadesdtn, dest_endpoint,
                                    label="Crossbow Transfer", sync_level="checksum")
        tdata.add_item(resource_path,dest_path+filename)
@@ -336,10 +338,16 @@ class crossbowGlobus(crossbowBase):
        output: boolean
            whether or not the resource already exists on the endpoint
        '''
        #make sure endpoints are activated
        self._activate_endpoint(endpoint)
        
        #make sure file exists
        filename = os.path.basename(resource_path)
        directory,_ = os.path.split(resource_path)
        try:
            r = self.transfer.operation_ls(endpoint,path=directory,filter='name:'+filename)
        except:
            return False
        found = 0
        for item in r:
            found += 1
+2 −0
Original line number Diff line number Diff line
@@ -134,6 +134,7 @@ class crossbowMount(crossbowBase):
            os.makedirs(self.NFS_path + package)

        #copy file to crossbow NFS
        print "uploading %s" % filename
        prog = ProgressBar(widgets=[Percentage(), Bar()], maxval=100).start()
        self._copy_with_progress(
                resource_path, nfs_path, 
@@ -181,6 +182,7 @@ class crossbowMount(crossbowBase):
        dest_path = destination + os.path.basename(resource_path)
        
        #copy file to local drive
        print "downloading %s" % resource
        prog = ProgressBar(widgets=[Percentage(), Bar()], maxval=100).start()
        self._copy_with_progress(
                resource_path, dest_path, 
+35 −0
Original line number Diff line number Diff line
#!/bin/bash
#PBS -A CSC237
#PBS -N MOLDYN_TEST
#PBS -l walltime=12:00:00
#PBS -l nodes=1
#PBS -lpartition=gpu

module load cudatoolkit
module load cuda

#clone repo/get latest
cd ${HOME}/
if [ ! -d crossbow ]; then
    git clone https://code.ornl.gov/v33/crossbow.git
else
    cd ${HOME}/crossbow/
    git pull
fi

# set python paths
export PATH=/ccs/home/iamshang/anaconda2/bin:/ccs/home/iamshang/anaconda2/lib/python2.7/site-packages:$PATH
export PYTHONPATH=/ccs/home/iamshang/crossbow/crossbow:$PYTHONPATH

# run scripts
cd ${HOME}/crossbow/moldyn_example/scripts/

if [ ! -f 1FME-0_contact_matrix.npy ]; then
    python dcd2array.py ${HOME}/1fme-0
fi

python conv_vae.py 1FME-0_contact_matrix.npy

#cleanup
cd ${HOME}/
rm conv_vae.pbs
+48 −0
Original line number Diff line number Diff line
from crossbowGlobus import crossbowGlobus
from crossbowOlcf import crossbowOlcf
import time
import sys

#get pbs to submit
args = (sys.argv)
if len(args) != 2:
    raise Exception("Usage: python run_experiment.py <.pbs file>")
pbs_script = args[1]

#connect to CKAN, make sure 1fme-0 dataset exists
cbow = crossbowGlobus(api_key="eaabd7d9-3cb4-4014-85fe-73736e658472",
                      token_file='../crossbow/refresh-tokens.json')
packages = cbow.list_packages()
if '1fme-0' not in packages:
    raise Exception("1fme-0 package is missing from CKAN")

#connect to OLCF before download starts
olcf = crossbowOlcf('rhea')

#download 1fme-0 dataset if it doesn't exist
print 'downloading resources'
olcf_endpoint = 'ef1a9560-7ca1-11e5-992c-22000b96db58'
path = '/~/1fme-0/'
idx = packages.index("1fme-0")
resources = cbow.list_resources(packages[idx])
dl = []
for resource in resources:
    print 'checking %s' % resource
    if not cbow.check_resource_exists_endpoint('/~/1fme-0/%s' % resource):
        dl_id = cbow.download_resource('1fme-0',resource,dest_endpoint=olcf_endpoint,
                                       dest_path=path,wait_for_download=False)
        dl.append(resource)
                               
#wait for downloads to complete
print "waiting for downloads to complete"
timeout = 600
start = time.time()
for resource in dl:
    while not cbow.check_resource_exists_endpoint('/~/1fme-0/%s' % resource):
        time.sleep(10)
        if time.time() - start > timeout:
            raise Exception('transfer timeout reached')

#submit pbs
print 'submitting pbs script to start experiment'
olcf.qsub(pbs_script)