[Swift-user] Question about mappers

Michael Wilde wilde at mcs.anl.gov
Thu Mar 29 21:46:49 CDT 2012


Lorenzo,

I think your outputs are all going to the current working directory in which you run the swift command, because when you map the output files in these statements, you are not specifying any directory in the filename:

file result <single_file_mapper; file=@strcat("result_neuron_", chn, "_ht_",s,".mat")>;
file LogDemoReal <single_file_mapper; file=@strcat("demo_real", chn, "_ht_",s,".log")>;

If you want these files to get created in one of the WinDirs directories, you should prepend win,"/" in front:

file result <single_file_mapper; file=@strcat(win,"/"."result_neuron_",...

Was that what you intended?

Also, there should be no need to generate the Swift script with shell variable substitution. You can pass in values from the shell script via swift command line and access them from the Swift script with the @arg() function.

You can make htvec and chnvec string vectors instead of ints, and pass them like so:

swift -tc.file etc etc myscript.swift -htvec=1,3,5 -chnvec=a,b,c -currdir=$PWD

and in the script do:

string htvec[]=@strsplit(@arg("htvec"));

You can use the strng htvec[] in your later @strcat() call in the same way you used the int version of that vector.

- Mike





----- Original Message -----
> From: "Lorenzo Pesce" <lpesce at uchicago.edu>
> To: swift-user at ci.uchicago.edu
> Sent: Thursday, March 29, 2012 9:03:48 PM
> Subject: [Swift-user] Question about mappers
> Hi all--
> Thanks a lot for your help. I have another question.
> 
> This is what my problem looks like. There is a set of input files, all
> with the same name (say X.mat), in a set of subdirectories of say
> <root_dir>:
> Win1
> Win2
> Win3
> .
> .
> .
> WinN
> 
> 
> 
> The applications takes the input file as *filename* (string) and not a
> handle, then some other parameters and produces a couple of output
> files (see below for app demoreal).
> 
> For each directory, say Win1, each file X.mat is mapped to many output
> files result_neuron_<i>_ht_<j>.mat, where i and j are a parameter
> sweep (same for all windows, but the X.mat files are different).
> 
> My script pokes around, takes some input and then spews up a swift
> script. My mapping misfires and all the output files end up in
> <root_dir>, which doesn't work because many should have the same name.
> If the input file were a handle, I would use a file type and map input
> and output and I think that I would know how to do that. Here I have
> no idea.
> 
> // file to run the Margic square example from the matlab web site
> type file;
> 
> string MCRPath = "/soft/matlab/7.13";
> string spikefilename = "$infile";
> 
> app (file outdata,file result) demoreal (string mcr, int chn, int
> htin, string datafile)
> {
> runDemoReal mcr chn htin datafile stdout=@outdata;
> }
> 
> string WinDirs[] = ${swiftWinDirs};
> int htvec[] = ${htvec};
> int chnvec[] = ${chnvec};
> 
> 
> foreach win in WinDirs {
> string spikefile = @strcat("${currdir}/",win,spikefilename);
> foreach chn in chnvec {
> foreach s, i in htvec {
> file result <single_file_mapper; file=@strcat("result_neuron_", chn,
> "_ht_",s,".mat")>;
> file LogDemoReal <single_file_mapper; file=@strcat("demo_real", chn,
> "_ht_",s,".log")>;
> (LogDemoReal,result) = demoreal (MCRPath, chn, s, spikefile);
> }
> }
> }
> 
> 
> 
> 
> 
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user

-- 
Michael Wilde
Computation Institute, University of Chicago
Mathematics and Computer Science Division
Argonne National Laboratory




More information about the Swift-user mailing list