Logo
latest

User Guide

  • Overview
  • Definitions
  • Assumptions and Semantics
  • Limitations and Workarounds
  • Build UnifyFS
  • Integrate the UnifyFS API
  • Link with the UnifyFS library
    • Static link
    • Dynamic link
      • C
      • Fortran
  • UnifyFS Configuration
  • Run UnifyFS

Reference

  • Example Programs
  • UnifyFS API for I/O Middleware
  • UnifyFS Dependencies
  • UnifyFS Error Codes
  • VerifyIO: Determine UnifyFS Compatibility

Contributing

  • Contributing Guide
  • Developer Documentation
  • Style Guides
  • Testing Guide
  • Wrapper Guide
  • Adding RPC Functions With Margo Library
UnifyFS
  • Docs »
  • Link with the UnifyFS library
  • Edit on GitHub

Link with the UnifyFS library¶

This section describes how to link an application with the UnifyFS library. The UnifyFS library contains symbols for the UnifyFS API, like unifyfs_mount, as well as wrappers for I/O routines, like open, write, and close. In the examples below, replace <unifyfs> with the path to your UnifyFS install.


Static link¶

For a static link, UnifyFS utilizes the --wrap feature of the ld command. One must specify a --wrap option for every I/O call that is wrapped, for which there are many. To make this easier, UnifyFS installs a unifyfs-config script that one should invoke to specify those flags, e.g.,

$ mpicc -o test_write \
      `<unifyfs>/bin/unifyfs-config --pre-ld-flags` \
      test_write.c \
      `<unifyfs>/bin/unifyfs-config --post-ld-flags`

Dynamic link¶

A build of UnifyFS includes two different shared libraries. Which one you should link against depends on your application. If you wish to take advantage of the UnifyFS auto-mount feature (assuming the feature was enabled at compile-time), then you should link against libunifyfs_mpi_gotcha.so. If you are not building an MPI-enabled application, or if you want explicit control over when UnifyFS filesystem is mounted and unmounted, then link against libunifyfs_gotcha.so. In this case, you will also have to add calls to unifyfs_mount and unifyfs_unmount in the appropriate locations in your code. See Integrate the UnifyFS API.

To intercept I/O calls using gotcha, use the following syntax to link an application:

C¶

For code that uses the auto-mount feature:

$ mpicc -o test_write test_write.c \
    -L<unifyfs>/lib -lunifyfs_mpi_gotcha

For code that explicitly calls unifyfs_mount and unifyfs_unmount:

$ mpicc -o test_write test_write.c \
    -I<unifyfs>/include -L<unifyfs>/lib -lunifyfs_gotcha

Note the use of the -I option so that the compiler knows where to find the unifyfs.h header file.

Fortran¶

For code that uses the auto-mount feature:

$ mpif90 -o test_write test_write.F \
    -L<unifyfs>/lib -lunifyfs_mpi_gotcha

For code that explicitly calls unifyfs_mount and unifyfs_unmount:

$ mpif90 -o test_write test_write.F \
    -I<unifyfs>/include -L<unifyfs>/lib -lunifyfsf -lunifyfs_gotcha

Note the use of the -I option to specify the location of the unifyfsf.h header. Also note the use of the unifyfsf library. This library provides the Fortran bindings for the unifyfs_mount and unifyfs_unmount functions.

Next Previous

© Copyright 2020, Lawrence Livermore National Security LLC, LLNL-CODE-741539, UT-Batelle LLC Revision 5884ff12.

Built with Sphinx using a theme provided by Read the Docs.
Read the Docs v: latest
Versions
latest
v1.1
v1.0.1
v1.0
dev
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.