Changeset 20289
- Timestamp:
- 03/02/16 20:18:26 (9 years ago)
- Location:
- issm/trunk-jpl/src/m
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/clusters/generic.js
r20271 r20289 26 26 return "generic"; 27 27 }// }}} 28 29 30 31 32 33 34 35 36 this.UploadAndRun = function (md,callbackfunction,fid,toolkitsstring,solutionstring,name) { //{{{28 this.checkconsistency = function (md,solution,analyses) { //{{{ 29 if (cluster.np<1){ 30 md.checkmessage('number of processors should be at least 1'); 31 } 32 if (isNaN(cluster.np)){ 33 md.checkmessage('number of processors should not be NaN!'); 34 } 35 } //}}} 36 this.BuildQueueScript = function (cluster,dirname,modelname,solution,io_gather,isvalgrind,isgprof,isdakota) { // {{{ 37 37 38 var oReq = new XMLHttpRequest();39 oReq.open("POST", this.url, true);40 oReq.responseType = 'arraybuffer';38 //write queuing script 39 //what is the executable being called? 40 executable='issm.exe'; 41 41 42 oReq.onload = function (oEvent) {43 var returnBuffer = new Uint8Array(oReq.response.slice());44 var returnBuffer_size=returnBuffer.byteLength;45 md.results= parseresultsfrombuffer(returnBuffer,returnBuffer_size);46 callbackfunction();47 };42 fid=fopen(modelname+'.queue','w'); 43 fprintf(fid,'#!%s\n',cluster.shell); 44 fprintf(fid,'mpiexec -np %i %s/%s %s %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,executable,EnumToString(solution),cluster.executionpath+'/'+dirname,modelname,modelname,modelname); 45 fclose(fid); 46 } //{{{ 47 this.UploadAndRun = function (md,callbackfunction,fid,toolkitsstring,solutionstring,name,runtimename) { //{{{ 48 48 49 oReq.send(new Int8Array(fid.buffer)); 50 return; 49 var oReq = new XMLHttpRequest(); 50 oReq.open("POST", this.url, true); 51 oReq.responseType = 'arraybuffer'; 51 52 52 } /*}}}*/ 53 oReq.onload = function (oEvent) { 54 var returnBuffer = new Uint8Array(oReq.response.slice()); 55 var returnBuffer_size=returnBuffer.byteLength; 56 md.results= parseresultsfrombuffer(returnBuffer,returnBuffer_size); 57 callbackfunction(); 58 }; 59 60 var runtimenamebuffer = this.str2ab(runtimename); 61 var runtimenamelength = new Uint32Array(1); 62 runtimenamelength[0] = runtimenamebuffer.byteLength; 63 64 var namebuffer = this.str2ab(name); 65 var namelength = new Uint32Array(1); 66 namelength[0] = namebuffer.byteLength; 67 68 var toolkitsbuffer = this.str2ab(toolkitsstring); 69 var toolkitslength = new Uint32Array(1); 70 toolkitslength[0] = toolkitsbuffer.byteLength; 71 72 var solutionbuffer = this.str2ab(solutionstring); 73 var solutionlength = new Uint32Array(1); 74 solutionlength[0] = solutionbuffer.byteLength; 75 76 var binbuffer = new Uint16Array(fid.buffer); 77 var binlength = new Uint32Array(1); 78 binlength[0] = binbuffer.byteLength; 79 80 var data = new Blob([runtimenamelength,runtimenamebuffer,namelength,namebuffer,toolkitslength,toolkitsbuffer,solutionlength,solutionbuffer,binlength,binbuffer]); 81 //console.log([runtimenamelength,runtimenamebuffer,namelength,namebuffer,toolkitslength,toolkitsbuffer,solutionlength,solutionbuffer,binlength,binbuffer]); 82 oReq.send(data); 83 return; 84 85 } //}}} 86 this.ab2str = function(buf) { 87 return String.fromCharCode.apply(null, new Uint16Array(buf)); 53 88 } 89 this.str2ab = function(str) { 90 var buf = new Uint8Array(str.length); 91 for (var i=0, strLen=str.length; i < strLen; i++) { 92 buf[i] = str.charCodeAt(i); 93 } 94 return buf; 95 } 96 } -
issm/trunk-jpl/src/m/solve/solve.js
r20270 r20289 131 131 132 132 /*We are running somewhere else on a computational server. Send the buffer to that server and retrieve output: */ 133 cluster.UploadAndRun(md,callbackfunction,fid,toolkitsstring,solutionstring,md.miscellaneous.name );133 cluster.UploadAndRun(md,callbackfunction,fid,toolkitsstring,solutionstring,md.miscellaneous.name,md.priv.runtimename); 134 134 135 135 return md;
Note:
See TracChangeset
for help on using the changeset viewer.