Mounting UnifyFS

In this section, we describe how to use the UnifyFS API in an application.

Attention

Fortran Compatibility

unifyfs_mount and unifyfs_unmount are now usable with GFortran. There is a known ifort_issue with the Intel Fortran compiler as well as an xlf_issue with the IBM Fortran compiler. Other Fortran compilers are currently unknown.

If using fortran, when installing UnifyFS with Spack, include the +fortran variant, or configure UnifyFS with the --enable-fortran option if building manually.

Mounting

In C applications, include unifyfs.h. See writeread.c for a full example.

#include <unifyfs.h>

In Fortran applications, include unifyfsf.h. See writeread.f90 for a full example.

include 'unifyfsf.h'

To use the UnifyFS filesystem a user will have to provide a path prefix. All file operations under the path prefix will be intercepted by the UnifyFS filesystem. For instance, to use UnifyFS on all path prefixes that begin with /tmp this would require a:

unifyfs_mount('/tmp', rank, rank_num, 0);
Fortran
call UNIFYFS_MOUNT('/tmp', rank, size, 0, ierr);

Where /tmp is the path prefix you want UnifyFS to intercept. The rank and rank number is the rank you are currently on, and the number of tasks you have running in your job. Lastly, the zero corresponds to the app id.

Unmounting

When you are finished using UnifyFS in your application, you should unmount.

if (rank == 0) {
    unifyfs_unmount();
}
Fortran
call UNIFYFS_UNMOUNT(ierr);

It is only necessary to call unmount once on rank zero.