Example of using NetCDF libraries on the cluster. The specific example creates a random vector and writes it to a netCDF (nc) file.
(1) netcdf_test.f90: Fortran 90 source file
(2) Makefile: Makefile to compile the source code
(3) netcdf_test.sbtach: Btach-job submission script to send the job to the queue
source new-modules.sh
module load gcc/4.8.2-fasrc01
module load openmpi/1.10.0-fasrc01
module load netcdf/4.1.3-fasrc03
make
sbatch netcdf_test.sbatch
[pkrastev@sa01 NETCDF]$ ncdump vector_x.nc
netcdf vector_x {
dimensions:
x = 100 ;
variables:
double data(x) ;
data:
data = 0.199970146344458, 0.141934933985806, 0.960899721823899,
0.557534698231841, 0.638827353932728, 0.462286697925639,
0.498032266914685, 0.867237658472843, 0.762327982439892,
0.236420379313575, 0.0605957232862359, 0.150952538730771,
0.948070720186728, 0.844534692114927, 0.18170151986113,
0.280175418076098, 0.229308177514722, 0.552097075385628,
0.739919614073644, 0.331058865637016, 0.388761760005066,
0.416349607224829, 0.325442530795856, 0.412334314338389,
0.631471675140761, 0.890653877810587, 0.765587525347705,
0.144551397911807, 0.148685567794885, 0.00652109881557073,
0.36789388259525, 0.152967878673773, 0.220681017758714,
0.629016578210196, 0.459203968012824, 0.697648284269158,
0.389048422996959, 0.919453418996081, 0.199216871365762,
0.587279998390587, 0.363542476718316, 0.754134850671609,
0.194908264487618, 0.815830987926723, 0.938569115455452,
0.423430092024579, 0.296154904624167, 0.811725206042843,
0.364880724680468, 0.893735362723437, 0.00850734175939594,
0.887925918887739, 0.194576050497013, 0.588768688348484,
0.0942312363349586, 0.047002267670685, 0.92125388794516,
0.331883143613703, 0.0983307302190169, 0.941179041381638,
0.0732382749286801, 0.578578819636673, 0.668020787107081,
0.175047984049305, 0.872877874313327, 0.306460844332695,
0.956044245961221, 0.132239732260005, 0.905965548377544,
0.75827139955462, 0.984020485169999, 0.417582943189947, 0.18721635070516,
0.846184223068275, 0.32255152387762, 0.500835812835395,
0.221773556727815, 0.736673814165441, 0.31810307800343,
0.584469407470076, 0.969399961583496, 0.433704381734002,
0.0462206676927902, 0.207506498131315, 0.933282795604959,
0.789315034676646, 0.48494706328476, 0.0456330337094096,
0.756138675614937, 0.152743123680129, 0.741604010026006,
0.256808690736954, 0.013487870618537, 0.440945443529211,
0.603259484938656, 0.945959505246437, 0.566918499966449,
0.348724013137411, 0.493279464049104, 0.437733302620056 ;
}