[Swift-user] Swift + Matlab

Alex Moore amoore2 at uchicago.edu
Wed Jun 3 16:43:35 CDT 2009


Hey Mike,
I'm trying to execute the compiled matlab executable through swift,
and I'm running into some trouble. I can run swift on the examples
provided, and I can compile the matlab executable fine without swift.
I've followed  the procedure you detailed exactly (I copy and pasted
the email below for reference), and I get the same error messages.
When I run the swift app you detail below, I get the following
messages:

Swift 0.9 swift-r2860 cog-r2388

RunID: 20090603-1623-nis6ejxc
Progress:
Failed to transfer wrapper log from hwsq-20090603-1623-nis6ejxc/info/b
on local host
Failed to transfer wrapper log from hwsq-20090603-1623-nis6ejxc/info/a
on local host
Progress Selecting site:7 Stage in:1 Failed but can retry:2
Failed to transfer wrapper log from hwsq-20090603-1623-nis6ejxc/info/e
on local host
Progress Selecting site:7 Failed but can retry:3
Progress Selecting site:7 Failed but can retry:3
Progress Selecting site:7 Failed but can retry:3
Progress Selecting site:6 Stage in:1 Failed but can retry:3
Failed to transfer wrapper log from hwsq-20090603-1623-nis6ejxc/info/g
on local host

It keeps on going, picking decreasing the Selecting site: number. The
program doesn't terminate either (is there some command I can use to
stop it?). I think the trouble might be something with my entries in
tc.data? I use this entry for tc.data that you specified (I changed
the path and directories for my path):

> localhost       runhwsq /home/amoore2/Work/hwsq.sh INSTALLED  INTEL32::LINUX  null

I then changed it to run_hwsq.sh since this is also one of the
executables that matlab produces, but I still got the same error
messages. Also, you seem to use hwsq and runhwsq interchangeably in
the swift file and in the tc.data entry above. Here is part of the
hwsq.swift file:

,> app (file outdata) hwsq (file indata, int factor)
> {
>  runhwsq @indata @outdata factor;
> }
>

Is there a reason why in the first line you define the app hwsq, then
refer to runhwsq? Or, use tc.data to tell swift that runhwsq is
located at hwsq.sh?

Also, where did you input this wrapper?
> ...to call this wrapper (which I wrote):
>
> ---
>
> /home/wilde/matlablab/test1/bin/run_hwsq.sh ~/matlablab/MCR/v77/ $*

Thanks.
-Alex Moore



> -------- Original Message --------
> Subject: Swift MatLab example
> Date: Wed, 04 Mar 2009 00:16:57 -0600
> From: Michael Wilde <wilde at mcs.anl.gov>
> To: Andrew Robert Jamieson <andrewj at uchicago.edu>
> CC: Tibi Stef-Praun <tiberius at ci.uchicago.edu>,  Benjamin Clifford
> <benc at ci.uchicago.edu>
> References: <49A5F0F7.8000109 at mcs.anl.gov>
> <Pine.GSO.4.62.0902271035360.28986 at harper.uchicago.edu>
> <49A83FA3.4090702 at mcs.anl.gov>
> <Pine.GSO.4.62.0902271332250.28986 at harper.uchicago.edu>
> <49ADA7AF.4000106 at mcs.anl.gov>
>
> Andrew,
>
> I played with the mcc compiler till I got a basic test working - a
> simple wrapper around the "magic-square" hello-world program, but which
> passes the degree f the matrix in via an input file, as well as a
> parameter to transform the matrix (multiple by a scalar parameter) and
> write and return the final matrix in a file.
>
> So that gives me this swift app:
>
> ---
>
> type file;
>
> app (file outdata) hwsq (file indata, int factor)
> {
>  runhwsq @indata @outdata factor;
> }
>
> file degreeData<"degree.dat">;
>
> int factors[] = [0:9];
> file squareMats[] <simple_mapper; prefix="sqmat.",suffix=".dat">;
>
> foreach f, i in factors {
>  squareMats[i] = hwsq (degreeData, f);
> }
>
>
> ---
>
> to run this matlab code:
>
> ---
>
> ::::::::::::::
> hwsq.m
> ::::::::::::::
> function m = hwsq(infile,outfile,fac)
> n = dlmread(infile)
> if ischar(fac)
>    fac=str2num(fac);
> end
> m = myf1(n,fac)
> dlmwrite(outfile,m)
> ::::::::::::::
> myf1.m
> ::::::::::::::
> function m = myf1(n,fac)
>
> if ischar(n)
>    n=str2num(n);
> end
> g = magic(n)
> m = g * fac
>
> ---
>
> I use these entries in tc.data:
>
> ---
>
> localhost       runhwsq /home/wilde/matlablab/test1/bin/hwsq.sh INSTALLED
> INTEL32::LINUX  null
> uc32    runhwsq /home/wilde/mccapps/hwsq/hwsq.sh        INSTALLED
> INTEL32::LINUX  null
>
> ---
>
> ...to call this wrapper (which I wrote):
>
> ---
>
> /home/wilde/matlablab/test1/bin/run_hwsq.sh ~/matlablab/MCR/v77/ $*
>
> ---
>
> which calls the run_hwsq.h wrapper that mcc created for me, when I
> compiled my .m files with:
>
> ---
>
> mcc -o hwsq -m -d bin -v hwsq.m -a myf1.m
>
> ---
>
> Then I edited run_hwsq.sh to specify a full (instead of relative) path
> for it to invoke the hwsq compiled executable:
>
> ---
>
> /home/wilde/matlablab/test1/bin/hwsq $*
>
> instead of:
>
> ./hwsq $*
>
> ---
>
> I think that covers it. I was able to run this locally on
> login.ci.uchicago.edu, as well as to uc-teragrid 32-bit viz nodes, from
> login.ci as submit host.
>
> I think we have all the parts here to run on x86_64 machines as well.
>
> Now that I get the gist of matlab compilation and execution, I think I
> (we?) can turn this into a mini-matlab tutorial.
>
> But hopefully the above can get you started.
>
> Lets meet as soon as possible, ideally after you try to reproduce y
> steps, and then to a first-run of your actual code.
>
> Passing other files, including .mat files, should be similar to the above.
>
> - Mike



More information about the Swift-user mailing list