<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Swift Users,<br><br>I am wondering if I could get some advice on the best way to do the following in Swift: I want to run a series of simulations performing a parameter scan, for each parameter combination farming the work out to clusters I have access to here at Stanford, and collect the results back onto my desktop. <br>
<br>I've gotten some minimal working examples of swift up and running, but hit a roadblock on something quite simple: what's the best way to pass a large number of parameters into a swift script? I have a big list of parameter combinations I'd like to run, and am searching for a sane way to pass all of these into my swift app call. <br>
<br>Originally, I thought I'd be able to use the CSV mapper to pass a bunch of arguments from a CSV file into swift -- it seemed perfect! As a bonus, I hoped the CSV file would act as a record of my work, namely what parameters were used to generate what file. But it seems that the CSV mapper automatically maps the entries in the CSV file to swift "mapper" objects -- i.e., it expects my CSV data fields are all files, where as I want some to be ints or floats that get passed directly to the arguments of my command-line script on the slave machine(s).<br>
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">For concreteness, here is a test CSV I was working with:<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
<br><span style="font-family:courier new,monospace">coords,qvals,numphi,numshots,nummolec,photons,parallel,output_filename<br>gold_5nm.coor,gold_qvals.txt,3600,10,1,0.25,12,out0.ring<br>gold_5nm.coor,gold_qvals.txt,3600,10,2,0.5,12,out1.ring<br>
gold_5nm.coor,gold_qvals.txt,3600,10,4,1.0,12,out2.ring<br>gold_5nm.coor,gold_qvals.txt,3600,10,8,2.0,12,out3.ring<br>gold_5nm.coor,gold_qvals.txt,3600,10,16,4.0,12,out4.ring</span><br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
and my (non-functional) swift script, which will show what I was trying to do:<br><br><span style="font-family:courier new,monospace"># shoot.swift<br><br>type messagefile; <br>type pdbfile;<br>type shotfile;<br><br>type shootargs{<br>
    pdbfile coords;<br>    messagefile qvals;<br>    int numphi;<br>    int numshots;<br>    int nummolec;<br>    int photons;<br>    int parallel;<br>    string output_filename;<br>}<br><br>app (shotfile outputfile) shootsim (shootargs args) {   <br>
     polshoot "-s" @args.coords "-f" @args.qvals "-x" args.numphi "-n" args.numshots "-m" args.nummolec "-g" args.photons "-p" args.parallel "-o" @outputfile;<br>
}<br><br><br>shootargs myargs[] <csv_mapper;file="particles_per_shot.csv">;<br><br>foreach a in myargs {<br>    shotfile o; // this could be something like myargs.output_filename<br>    o = shootsim(a);<br>
}</span><br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I'm wondering if someone who's worked a bit with swift can give me a recommendation on how to proceed. Right now I'm playing with just writing a huge number of flat text files, each one containing the parameter flags that will then get cat'd into the arguments of my command-line script "polshoot" on the slave end. This is inelegant for obvious reasons, since I'll have a huge number of input files and no easy way to keep track of which input matches what output...<br>
<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">If anyone has advice, I'm all ears!<br><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">
Thanks,<br><br>TJ<br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div></div>