Skip to content
This repository was archived by the owner on Oct 26, 2019. It is now read-only.

Commit 06fefbe

Browse files
Swift 0.95 changes, and various updates to Swift scripts from private branch
1 parent 4078940 commit 06fefbe

12 files changed

+195
-255
lines changed

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ nco | http://nco.sourceforge.net | Requ
1313
netcdf4 | http://www.unidata.ucar.edu/software/netcdf | Required
1414
netcdf4 python libraries | http://code.google.com/p/netcdf4-python | Required
1515
Oracle Java 7 | http://www.oracle.com/us/downloads/index.html | Required
16-
Swift 0.94.1 | http://swiftlang.org | Required
16+
Swift 0.95 | http://swiftlang.org | Required
1717

1818
How to Run
1919
==========
@@ -62,7 +62,8 @@ num\_lons | Number of longitudes to be included in final nc4 file (starting
6262
num\_years | Number of years to simulate? | num\_years 31
6363
out\_file | Defines the prefix of the final nc4 filename (eg, $out\_file.nc4) | out\_file out.psims.dssat45.agmerra.wheat.demo
6464
outtypes | File extensions of files to include in output tar file | outtypes .WTH,.WHX,.SOL,.OUT,.json,.txt
65-
PATH | Defines the bash $PATH that will be used for run (only psims bin/ added by default. | PATH /project/joshuaelliott/psims/tapps/pdssat:$PATH
65+
PATH | Defines the bash $PATH that will be used for run (only psims bin/ added by default) | PATH /project/joshuaelliott/psims/tapps/pdssat:$PATH
66+
plots | Determines if plots will be generated after run. If undefined, defaults to true | plots false
6667
refdata | Directory containing reference data. Will be copied to each simulation | refdata /Users/davidk/psims/data/common.isimip
6768
ref\_year | Reference year (the first year of the simulation) | ref\_year 1980
6869
s3\_tar\_inputs| Similar to tar_inputs, but download data from an s3 bucket. Requires s3cmd util | s3\_tar\_inputs s3://psims/soil/hwsd200.wrld.30min.tar.gz
@@ -135,9 +136,8 @@ of time spent staging in and out files to the work directories.
135136

136137
How to Modify Swift Configuration
137138
=================================
138-
Determining how Swift runs is controlled by files called conf/<sitename>.xml and conf/<sitename>.cf. These files define the
139-
scheduler to use, the location of work and scratch directories, and the amount of parallelism. More information about
140-
swift.properties options can be found at http://swiftlang.org/guides/release-0.94/userguide/userguide.html.
139+
Determining how Swift runs is controlled by a file called conf/swift.properties. This file defines the
140+
scheduler to use, the location of work and scratch directories, and the amount of parallelism.
141141

142142
Debugging
143143
=========
@@ -174,7 +174,7 @@ Midway is a cluster at the University of Chicago. More information about Midway
174174

175175
To run pSIMS on midway, the first thing you need to do is load the required modules.
176176

177-
$ module load java ant git mono/2.10 hdf5/1.8 nco/4.3 boost/1.50 netcdf/4.2 jasper python/2.7 cdo/1.6 tcllib/1.15 swift
177+
$ module load java ant git mono/2.10 hdf5/1.8 nco/4.3 boost/1.50 netcdf/4.2 jasper python/2.7 cdo/1.6 tcllib/1.15 swift/0.95-RC5
178178

179179
The conf/midway.xml file is configured to use the sandyb slurm partition. The sandyb partition has 16 cores per node. The default configuration
180180
is to request nodes in chunks of 3, up to the Midway limit of 1536 total cores.

RunpSIMS.swift

+13-16
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
11
type file;
22

3-
app (file tar_out, file part_out) RunpSIMS (string latidx, string lonidx, string input_files)
4-
{
5-
RunpSIMS latidx lonidx @tar_out input_files;
3+
app (external ex) RunpSIMS (string latidx, string lonidx, string tar_out, string part_out, string input_files) {
4+
RunpSIMS latidx lonidx tar_out part_out input_files;
65
}
76

87
string gridLists[] = readData("gridList.txt");
9-
file scenario_input[] <filesys_mapper; location=@arg("campaign"), pattern="*">;
10-
file common_input[] <filesys_mapper; location=@arg("refdata"), pattern="*">;
11-
file params <single_file_mapper; file=@strcat(@arg("workdir"), "/params.psims")>;
12-
tracef("\nCreating part files...\n");
8+
file scenario_input[] <filesys_mapper; location=arg("campaign"), pattern="*">;
9+
file params <single_file_mapper; file=strcat(arg("workdir"), "/params.psims")>;
1310

14-
foreach g,i in gridLists {
11+
tracef("\nCreating part files . . .\n");
1512

13+
foreach g, i in gridLists {
1614
// Input files
17-
file weather_input[] <filesys_mapper; location=@strcat(@arg("weather"), "/", gridLists[i]), pattern="*">;
18-
file soils_input[] <filesys_mapper; location=@strcat(@arg("soils"), "/", gridLists[i]), pattern="*">;
15+
file soils_input[] <filesys_mapper; location=strcat(arg("soils"), "/", gridLists[i]), pattern="*">;
1916

2017
// Output files
21-
file tar_output <single_file_mapper; file=@strcat("output/", gridLists[i], "output.tar.gz")>;
22-
file part_output <single_file_mapper; file=@strcat("parts/", gridLists[i], ".psims.nc")>;
18+
string tar_output = strcat(arg("pwd"), "/output/", gridLists[i], "output.tar.gz");
19+
string part_output = strcat(arg("pwd"), "/parts/", gridLists[i], ".psims.nc");
2320

2421
// RunpSIMS
25-
string gridNames[] = @strsplit(g, "/");
26-
string files_in = @strcat(@scenario_input, " ", @weather_input, " ", @soils_input, " ", @common_input, " ", @params);
27-
(tar_output, part_output) = RunpSIMS(gridNames[0], gridNames[1], files_in);
28-
22+
string gridNames[] = strsplit(g, "/");
23+
string files_in = strcat(@scenario_input, " ", @soils_input, " ", @params);
24+
external e;
25+
e = RunpSIMS(gridNames[0], gridNames[1], tar_output, part_output, files_in);
2926
}

combine.swift

-51
This file was deleted.

combine1.swift

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
type file;
2+
3+
app (external ex) combine1 (string lat, string var, string inputDir, string outputDir, string param) {
4+
combine1 lat var inputDir outputDir param;
5+
}
6+
7+
app (file output) findParts (string workDir) {
8+
findParts workDir stdout=@output;
9+
}
10+
11+
string params = strcat(arg("workdir"), "/params.psims");
12+
string variables[] = strsplit(strcat(arg("variables"), ",", arg("cal_vars")), ",");
13+
string lats[] = readData(findParts(arg("workdir")));
14+
string partDir = strcat(arg("workdir"), "/parts");
15+
string varDir = strcat(arg("workdir"), "/var_files");
16+
17+
# parts -> var_files
18+
tracef("\nRunning combine1 . . . %k\n", lats);
19+
foreach lat in lats {
20+
foreach var in variables {
21+
external e;
22+
e = combine1(lat, var, partDir, varDir, params);
23+
}
24+
}

combine2.swift

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
type file;
2+
3+
app (external ex) combine2 (int chunk, int varNum, string fileDir, string outDir, string param) {
4+
combine2 varNum chunk fileDir outDir param;
5+
}
6+
7+
string params = strcat(arg("workdir"), "/params.psims");
8+
string variables[] = strsplit(strcat(arg("variables"), ",", arg("cal_vars")), ",");
9+
string varDir = strcat(arg("workdir"), "/var_files");
10+
int num_chunks = toInt(arg("num_chunks", "1"));
11+
12+
# var_files -> nc files
13+
tracef("\nRunning combine2 . . .\n");
14+
foreach variable,variable_idx in variables {
15+
foreach chunk in [1:num_chunks] {
16+
external e;
17+
e = combine2(chunk, variable_idx+1, varDir, arg("workdir"), params);
18+
}
19+
}

combine3.swift

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
type file;
2+
3+
app (external ex) combine3 (string var, file scenarioInput[], string varDirectory, string param) {
4+
combine3 var varDirectory param;
5+
}
6+
7+
file scenarios[] <filesys_mapper; location=arg("campaign"), pattern="*">;
8+
string params = strcat(arg("workdir"), "/params.psims");
9+
string variables[] = strsplit(strcat(arg("variables"), ",", arg("cal_vars")), ",");
10+
11+
# nc files -> final files
12+
tracef("\nRunning combine3 . . . \n");
13+
foreach var in variables {
14+
external e;
15+
e = combine3(var, scenarios, arg("workdir"), params);
16+
}

conf/local.cf

-16
This file was deleted.

conf/local.xml

-37
This file was deleted.

conf/midway.cf

-16
This file was deleted.

conf/midway.xml

-43
This file was deleted.

0 commit comments

Comments
 (0)