User`s guide
Cray XMT™ Programming Environment User’s Guide
3.7 File I/O
The Cray XMT performs I/O to a RAM-based file system (RAMFS) and a network
file system (NFS). Neither the RAMFS nor the NFS are high-speed file systems,
therefore, any data over 2 gigabytes in size must to be written to a high-speed file
system, such as Lustre. You can use the NFS for small amounts of data, such as user
files.
During the system reboot, all data is lost from the RAMFS because it is not written
to disk. Any data that you need to retain across system boots must be written to the
Lustre file system prior to rebooting the system. The XMT-PE provides snapshot
functions that you can use to move data between the service nodes and the Cray XMT
compute nodes. Once the data is on the service nodes, you can use standard Cray XT
commands to move data to the Lustre file system.
The underlying details of the file system are abstracted behind UNIX library calls that
you can add to your program to perform I/O. The Cray XMT system provides some
support for concurrent I/O to multiple files, but you must provide explicit access
control for concurrent I/O to a single file.
The following sections discuss standard language-supported forms of I/O as well as
I/O using the low-level UNIX I/O functions. Each section discusses the semantics,
particularly parallelism, and performance possibilities.
3.7.1 Language-level I/O
In serial code, the standard I/O functions behave as specified in the ANSI C standard.
In parallel code, all calls to the standard I/O package are executed atomically. Atomic
execution means that while one call is executing, no other call can interfere with what
the first is doing. Each call appears to run from beginning to end without interruption.
#pragma mta assert parallel
for (i = 0; i < n; i++)
{
fprintf(f,"this is iteration %d\n", i);
}
The previous code asserts that the loop is parallel. In general, it is not safe for
the compiler to parallelize a loop that contains procedure calls, especially calls to
I/O functions. The assertion indicates to the compiler that, in this case, it is safe to
parallelize the loop. The atomicity guarantee ensures that each line written to f by
this loop is of the form that follows:
this is iteration i
Two lines are never mixed together, so the following never occurs:
this is this is iteration j
36 S–2479–20