Changeset 13071
- Timestamp:
- 08/16/12 15:30:45 (13 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/os/issmscpin.m
r12743 r13071 1 function scpin(host, login,port,path, packages)2 % SCPIN get packages from host, using scp on unix, and pscp on windows1 function issmscpin(host, login,port,path, packages) 2 %ISSMSCPIN get packages from host, using scp on unix, and pscp on windows 3 3 % 4 % usage: scpin(host,packages,path)4 % usage: issmscpin(host,packages,path) 5 5 % 6 6 % … … 35 35 [status,ISSM_DIR]=system('echo [%ISSM_DIR_WIN%]'); 36 36 if status, 37 error(' scpin error message: could not find ISSM_DIR_WIN environment variable');37 error('issmscpin error message: could not find ISSM_DIR_WIN environment variable'); 38 38 end 39 39 ISSM_DIR=ISSM_DIR(2:end-2); … … 45 45 [status,result]=system([ISSM_DIR '/externalpackages/ssh/pscp.exe -l "' username '" -pw "' key '" ' host ':' path '/' packages{i} ' ./']); 46 46 if status, 47 error(' scpin error message: could not call putty pscp');47 error('issmscpin error message: could not call putty pscp'); 48 48 end 49 49 end … … 72 72 for i=1:numel(packages), 73 73 if ~exist(['./' packages{i}]), 74 error(' scpin error message: could not call scp on *nix system');74 error('issmscpin error message: could not call scp on *nix system'); 75 75 end 76 76 end -
issm/trunk-jpl/src/m/os/issmscpin.py
r12944 r13071 6 6 from MatlabFuncs import * 7 7 8 def scpin(host, login,port,path, packages):8 def issmscpin(host, login,port,path, packages): 9 9 """ 10 SCPIN get packages from host, using scp on unix, and pscp on windows10 ISSMSCPIN get packages from host, using scp on unix, and pscp on windows 11 11 12 usage: scpin(host,packages,path)12 usage: issmscpin(host,packages,path) 13 13 """ 14 14 … … 42 42 ISSM_DIR=os.environ['ISSM_DIR_WIN'][1:-2] 43 43 else: 44 raise OSError(" scpin error message: could not find ISSM_DIR_WIN environment variable.")44 raise OSError("issmscpin error message: could not find ISSM_DIR_WIN environment variable.") 45 45 46 46 username=raw_input('Username: (quoted string) ') … … 51 51 subprocess.check_call('%s/externalpackages/ssh/pscp.exe -l "%s" -pw "%s" %s:%s %s' % (ISSM_DIR,username,key,host,os.path.join(path,package),os.getcwd()),shell=True) 52 52 except CalledProcessError as e: 53 raise CalledProcessError(" scpin error message: could not call putty pscp.")53 raise CalledProcessError("issmscpin error message: could not call putty pscp.") 54 54 55 55 else: … … 73 73 for package in packages: 74 74 if not os.path.exists(os.path.join('.',package)): 75 raise OSError(" scpin error message: could not call scp on *nix system.")75 raise OSError("issmscpin error message: could not call scp on *nix system.") 76 76 -
issm/trunk-jpl/src/m/os/issmscpout.m
r12743 r13071 1 1 function issmscpout(host,path,login,port,packages) 2 % SCPOUT send packages to a host, using scp on unix, and pscp on windows2 %ISSMSCPOUT send packages to a host, using scp on unix, and pscp on windows 3 3 % 4 % usage: scpout(host,path,packages)4 % usage: issmscpout(host,path,packages) 5 5 % 6 6 % … … 26 26 [status,ISSM_DIR]=system('echo [%ISSM_DIR_WIN%]'); 27 27 if status, 28 error(' scpout error message: could not find ISSM_DIR_WIN environment variable');28 error('issmscpout error message: could not find ISSM_DIR_WIN environment variable'); 29 29 end 30 30 ISSM_DIR=ISSM_DIR(2:end-2); … … 36 36 [status,result]=system([ISSM_DIR '/externalpackages/ssh/pscp.exe -l "' username '" -pw "' key '" ' packages{i} ' ' host ':' path]); 37 37 if status, 38 error(' scpout error message: could not call putty pscp');38 error('issmscpout error message: could not call putty pscp'); 39 39 end 40 40 end -
issm/trunk-jpl/src/m/os/issmscpout.py
r13043 r13071 3 3 import subprocess 4 4 import os 5 import shutil6 5 from MatlabFuncs import * 7 6 8 7 def issmscpout(host,path,login,port,packages): 9 8 """ 10 SCPOUT send packages to a host, using scp on unix, and pscp on windows9 ISSMSCPOUT send packages to a host, using scp on unix, and pscp on windows 11 10 12 usage: scpout(host,path,packages)11 usage: issmscpout(host,path,packages) 13 12 """ 14 15 print "host=",host16 print "path=",path17 print "login=",login18 print "port=",port19 print "packages=",packages20 13 21 14 #get hostname … … 28 21 here=os.getcwd() 29 22 os.chdir(path) 30 shutil.rmtree(package) 23 try: 24 os.remove(package) 25 except OSError as e: 26 pass 31 27 subprocess.call('ln -s %s %s' % (os.path.join(here,package),path),shell=True) 32 28 os.chdir(here) … … 39 35 ISSM_DIR=os.environ['ISSM_DIR_WIN'][1:-2] 40 36 else: 41 raise OSError(" scpout error message: could not find ISSM_DIR_WIN environment variable.")37 raise OSError("issmscpout error message: could not find ISSM_DIR_WIN environment variable.") 42 38 43 39 username=raw_input('Username: (quoted string) ') … … 48 44 subprocess.check_call('%s/externalpackages/ssh/pscp.exe -l "%s" -pw "%s" %s %s:%s' % (ISSM_DIR,username,key,package,host,path),shell=True) 49 45 except CalledProcessError as e: 50 raise CalledProcessError(" scpout error message: could not call putty pscp.")46 raise CalledProcessError("issmscpout error message: could not call putty pscp.") 51 47 52 48 else: -
issm/trunk-jpl/src/m/parameterization/parameterize.m
r13018 r13071 56 56 end 57 57 md.miscellaneous.notes=['Model created by using parameter file: ' parametername ' on: ' datestr(now)]; 58 -
issm/trunk-jpl/src/m/solve/WriteData.py
r13043 r13071 104 104 data=numpy.array([data]) 105 105 if len(data.shape) == 1: 106 data=data.reshape( numpy.size(data,0),1)106 data=data.reshape(1,numpy.size(data,0)) 107 107 108 108 #Get size … … 124 124 for i in xrange(s[0]): 125 125 for j in xrange(s[1]): 126 fid.write(struct.pack(' i',data[i][j])) #get to the "c" convention, hence the transpose126 fid.write(struct.pack('d',float(data[i][j]))) #get to the "c" convention, hence the transpose 127 127 # }}} 128 128 … … 132 132 data=numpy.array([data]) 133 133 if len(data.shape) == 1: 134 data=data.reshape( numpy.size(data,0),1)134 data=data.reshape(1,numpy.size(data,0)) 135 135 136 136 #Get size … … 152 152 for i in xrange(s[0]): 153 153 for j in xrange(s[1]): 154 fid.write(struct.pack(' i',data[i][j])) #get to the "c" convention, hence the transpose154 fid.write(struct.pack('d',float(data[i][j]))) #get to the "c" convention, hence the transpose 155 155 # }}} 156 156 157 157 elif strcmpi(format,'DoubleMat'): # {{{ 158 158 159 if isinstance(data,( int,long,float)):159 if isinstance(data,(bool,int,long,float)): 160 160 data=numpy.array([data]) 161 161 if len(data.shape) == 1: 162 data=data.reshape( numpy.size(data,0),1)162 data=data.reshape(1,numpy.size(data,0)) 163 163 164 164 #Get size … … 180 180 for i in xrange(s[0]): 181 181 for j in xrange(s[1]): 182 fid.write(struct.pack('d', data[i][j])) #get to the "c" convention, hence the transpose182 fid.write(struct.pack('d',float(data[i][j]))) #get to the "c" convention, hence the transpose 183 183 # }}} 184 184 … … 188 188 recordlength=4+4 #number of records + code 189 189 for matrix in data: 190 if isinstance(matrix,(bool,int,long,float)): 191 matrix=numpy.array([matrix]) 192 if len(matrix.shape) == 1: 193 matrix=matrix.reshape(1,numpy.size(matrix,0)) 194 190 195 s=matrix.shape 191 196 recordlength+=4*2+s[0]*s[1]*8 #row and col of matrix + matrix of doubles … … 202 207 #write each matrix: 203 208 for matrix in data: 209 if isinstance(matrix,(bool,int,long,float)): 210 matrix=numpy.array([matrix]) 211 if len(matrix.shape) == 1: 212 matrix=matrix.reshape(1,numpy.size(matrix,0)) 213 204 214 s=matrix.shape 205 215 fid.write(struct.pack('i',s[0])) … … 207 217 for i in xrange(s[0]): 208 218 for j in xrange(s[1]): 209 fid.write(struct.pack('d', matrix[i][j]))219 fid.write(struct.pack('d',float(matrix[i][j]))) 210 220 # }}} 211 221 -
issm/trunk-jpl/src/m/solve/loadresultsfromcluster.py
r13023 r13071 3 3 import socket 4 4 from MatlabFuncs import * 5 from loadresultsfromdisk import * 5 6 6 7 def loadresultsfromcluster(md,runtimename=False): … … 17 18 if runtimename: 18 19 md.private.runtimename=runtimename 19 end20 20 21 21 #Download outputs from the cluster … … 28 28 filelist.append('dakota_tabular.dat') 29 29 filelist.append(md.miscellaneous.name+'.outbin') 30 Download(cluster,md.private.runtimename,filelist)30 cluster.Download(md.private.runtimename,filelist) 31 31 32 32 #If we are here, no errors in the solution sequence, call loadresultsfromdisk. -
issm/trunk-jpl/src/m/solve/loadresultsfromdisk.py
r13043 r13071 1 1 import os 2 from parseresultsfromdisk import * 2 3 from EnumToString import EnumToString 3 4 … … 28 29 if not len(structure): 29 30 raise RuntimeError("No result found in binary file '%s'. Check for solution crash." % filename) 30 end31 31 md.results[structure[1]['SolutionType']]=structure; 32 32 -
issm/trunk-jpl/src/m/solve/solve.py
r13043 r13071 9 9 from marshall import * 10 10 from ispetsc import * 11 from waitonlock import * 12 from loadresultsfromcluster import * 11 13 12 14 def solve(md,solutionenum,*args): … … 79 81 marshall(md) # bin file 80 82 md.solver.PetscFile(md.miscellaneous.name+'.petsc') # petsc file 81 cluster.BuildQueueScript(md. miscellaneous.name,md.private.runtimename,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof) # queue file83 cluster.BuildQueueScript(md.private.runtimename,md.miscellaneous.name,md.private.solution,md.settings.io_gather,md.debug.valgrind,md.debug.gprof) # queue file 82 84 83 85 #we need to make sure we have PETSC support, otherwise, we run with only one cpu: -
issm/trunk-jpl/src/m/solve/waitonlock.m
r13006 r13071 1 function flag=waitonlock(md ,executionpath,login,port)1 function flag=waitonlock(md) 2 2 %WAITONLOCK - wait for a file 3 3 % … … 6 6 % 7 7 % Usage: 8 % flag=waitonlock(md ,executionpath)8 % flag=waitonlock(md) 9 9 10 10 %Get filename (lock file) and options -
issm/trunk-jpl/src/m/solve/waitonlock.py
r13006 r13071 4 4 from MatlabFuncs import * 5 5 6 def waitonlock(md ,executionpath,login,port):6 def waitonlock(md): 7 7 """ 8 8 WAITONLOCK - wait for a file … … 12 12 13 13 Usage: 14 flag=waitonlock(md ,executionpath)14 flag=waitonlock(md) 15 15 """ 16 16
Note:
See TracChangeset
for help on using the changeset viewer.