[12378] | 1 | function [B E]=pkriging(x,y,observations,x_interp,y_interp,varargin);
|
---|
| 2 | %PKRIGING - parallel Kriging
|
---|
| 3 | %
|
---|
| 4 | % Usage:
|
---|
| 5 | % [B E]=pkriging(x,y,observations,x_interp,y_interp,varargin);
|
---|
| 6 |
|
---|
| 7 | options=pairoptions(varargin{:});
|
---|
| 8 | cluster=getfieldvalue(options,'cluster',generic('np',10));
|
---|
[12384] | 9 | options=removefield(options,'cluster',0);
|
---|
[12662] | 10 | name = ['krig' num2str(feature('GetPid'))];
|
---|
[12378] | 11 |
|
---|
| 12 | % ========================================= MARSHALL.m =================================================
|
---|
| 13 | disp(['marshalling file ' name '.bin']);
|
---|
| 14 | fid=fopen([name '.bin'],'wb');
|
---|
| 15 | if fid==-1,
|
---|
| 16 | error(['marshall error message: could not open ' name '.bin file for binary writing']);
|
---|
| 17 | end
|
---|
| 18 |
|
---|
| 19 | %First, write MaximumNumberOfEnum to make sure that the Enums are synchronized
|
---|
| 20 | WriteData(fid,'enum',MaximumNumberOfEnums(),'data',true,'format','Boolean');
|
---|
| 21 |
|
---|
| 22 | %Write all data
|
---|
| 23 | WriteData(fid,'enum',0,'data',x,'format','DoubleMat');
|
---|
| 24 | WriteData(fid,'enum',1,'data',y,'format','DoubleMat');
|
---|
| 25 | WriteData(fid,'enum',2,'data',observations,'format','DoubleMat');
|
---|
| 26 | WriteData(fid,'enum',3,'data',x_interp,'format','DoubleMat');
|
---|
| 27 | WriteData(fid,'enum',4,'data',y_interp,'format','DoubleMat');
|
---|
[12384] | 28 | options.marshall(fid,5);
|
---|
[12378] | 29 | st=fclose(fid);
|
---|
| 30 | if st==-1,
|
---|
| 31 | error(['marshall error message: could not close file ' name '.bin']);
|
---|
| 32 | end
|
---|
| 33 | % ========================================= MARSHALL.m =================================================
|
---|
| 34 |
|
---|
| 35 | %Launch job on remote cluster
|
---|
| 36 | BuildKrigingQueueScript(cluster,name,'',1,0,0); %gather, valgrind, gprof
|
---|
[12384] | 37 | tic
|
---|
[12378] | 38 | LaunchQueueJob(cluster,name,name,{[name '.bin'] [name '.queue']});
|
---|
[12384] | 39 | toc
|
---|
[12662] | 40 | choice=input('Is the job successfully completed? (y/n)','s');
|
---|
[12378] | 41 | Download(cluster,name,{[name '.outbin']});
|
---|
[12662] | 42 | structure=parseresultsfromdisk([name '.outbin'],0);
|
---|
| 43 | delete([name '.outlog']);
|
---|
| 44 | delete([name '.errlog']);
|
---|
| 45 | delete([name '.outbin']);
|
---|
| 46 | delete([name '.bin']);
|
---|
| 47 | if ~ispc,
|
---|
| 48 | delete([name '.tar.gz']);
|
---|
| 49 | end
|
---|
[12378] | 50 |
|
---|
| 51 | %Process results
|
---|
[12381] | 52 | B=structure.AutodiffForward;
|
---|
[12662] | 53 | B=reshape(B,size(x_interp,2),size(x_interp,1))';
|
---|
[12381] | 54 | E=structure.AutodiffIsautodiff;
|
---|
[12662] | 55 | E=reshape(E,size(x_interp,2),size(x_interp,1))';
|
---|