Changes

Jump to: navigation, search

GPU621/Chapel

69 bytes added, 23:14, 29 November 2022
Library Utilities
This procedure writes a square array out to a file.
proc writeSquareArray(n, X, filename) { // Create and open an output file with the specified filename in write mode. var outfile = open(filename, iomode.cw); var writer = outfile.writer(); // Write the problem size in each dimension to the file. writer.writeln(n, " ", n); // Write out the array itself. writer.write(X); // Close the file. writer.close(); outfile.close(); }
// Create and open an output file with the specified filename in write mode.
var outfile = open(filename, iomode.cw);
var writer = outfile.writer();
 
// Write the problem size in each dimension to the file.
writer.writeln(n, " ", n);
 
// Write out the array itself.
writer.write(X);
 
// Close the file.
writer.close();
outfile.close();
}
This procedure reads a new array out of a file and returns it.
73
edits

Navigation menu