Skip to content

Commit

Permalink
Add --enable-fortran option
Browse files Browse the repository at this point in the history
Require users to be proactive when they want to use fortran since we
conflict with certain fortran compilers. This makes it easier to
protect the user when installing with spack, especially with an
incompatible fortran compiler.
  • Loading branch information
CamStan authored and adammoody committed May 13, 2019
1 parent d8184e3 commit a2a8e11
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 14 deletions.
16 changes: 14 additions & 2 deletions client/src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
lib_LTLIBRARIES = libunifycr.la libunifycr_gotcha.la libunifycrf.la
lib_LTLIBRARIES = libunifycr.la libunifycr_gotcha.la

if HAVE_FORTRAN
lib_LTLIBRARIES += libunifycrf.la
endif

libunifycrdir = $(includedir)
libunifycr_gotchadir = $(includedir)

AM_CFLAGS = -Wall -Wno-strict-aliasing

include_HEADERS = unifycr.h unifycrf.h
include_HEADERS = unifycr.h

if HAVE_FORTRAN
include_HEADERS += unifycrf.h
endif

CLIENT_COMMON_CPPFLAGS = \
-I$(top_builddir)/client \
Expand Down Expand Up @@ -67,7 +75,11 @@ libunifycr_gotcha_la_CFLAGS = $(CLIENT_COMMON_CFLAGS) $(GOTCHA_CFLAGS)
libunifycr_gotcha_la_LDFLAGS = $(CLIENT_COMMON_LDFLAGS) $(GOTCHA_LDFLAGS)
libunifycr_gotcha_la_LIBADD = $(CLIENT_COMMON_LIBADD) -lgotcha

if HAVE_FORTRAN

libunifycrf_la_SOURCES = unifycrf.c
libunifycrf_la_CPPFLAGS = $(CLIENT_COMMON_CPPFLAGS)
libunifycrf_la_CFLAGS = $(AM_CFLAGS) $(CLIENT_COMMON_CFLAGS)
libunifycrf_la_LIBADD = libunifycr_gotcha.la

endif
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,20 @@ AC_PROG_RANLIB
AC_PROG_LIBTOOL

# fortran support
AC_ARG_ENABLE([fortran],
AC_HELP_STRING([--enable-fortran],
[Enable fortran compatibility and features]))
AC_MSG_CHECKING(if fortran is wanted )
if test "x$enable_fortran" = "xyes"; then
AC_MSG_RESULT(yes)
AC_PROG_FC
AC_FC_LIBRARY_LDFLAGS
AC_FC_DUMMY_MAIN
AM_CONDITIONAL([HAVE_FORTRAN], [true])
else
AC_MSG_RESULT(no)
AM_CONDITIONAL([HAVE_FORTRAN], [false])
fi

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_MODE_T
Expand Down Expand Up @@ -143,9 +154,11 @@ AC_CHECK_HEADERS(mntent.h sys/mount.h)

# look for MPI and set flags
LX_FIND_MPI
if test "x$enable_fortran" = "xyes"; then
AC_LANG_PUSH([Fortran])
LX_FIND_MPI
AC_LANG_POP
fi

# look for leveldb library, sets LEVELDB_CFLAGS/LDFLAGS/LIBS
UNIFYCR_AC_LEVELDB
Expand Down
16 changes: 10 additions & 6 deletions docs/api-mount.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ In this section, we describe how to use the UnifyCR API in an application.
.. Attention:: **Fortran Compatibility**

``unifycr_mount`` and ``unifycr_unmount`` are now usable with GFortran.
There is a known issue_ with the Intel Fortran compiler. Other Fortran
compilers are currently unknown.
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 :ref:`installing UnifyCR <build-label>` with Spack,
include the ``+fortran`` variant, or configure UnifyCR with the
``--enable-fortran`` option if building manually.

---------------------------
Mounting
Expand All @@ -18,15 +23,13 @@ In ``C`` applications, include *unifycr.h*. See writeread.c_ for a full
example.

.. code-block:: C
:caption: C
#include <unifycr.h>
In ``Fortran`` applications, include *unifycrf.h*. See writeread.f90_ for a
full example.

.. code-block:: Fortran
:caption: Fortran
include 'unifycrf.h'
Expand Down Expand Up @@ -65,12 +68,13 @@ When you are finished using UnifyCR in your application, you should unmount.
.. code-block:: Fortran
:caption: Fortran
UNIFYCR_UNMOUNT(ierr);
call UNIFYCR_UNMOUNT(ierr);
It is only necessary to call unmount once on rank zero.

.. explicit external hyperlink targets
.. _issue: https://github.com/LLNL/UnifyCR/issues/300
.. _ifort_issue: https://github.com/LLNL/UnifyCR/issues/300
.. _writeread.c: https://github.com/LLNL/UnifyCR/blob/dev/examples/src/writeread.c
.. _writeread.f90: https://github.com/LLNL/UnifyCR/blob/dev/examples/src/writeread.f90
.. _xlf_issue: https://github.com/LLNL/UnifyCR/issues/304
23 changes: 17 additions & 6 deletions examples/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ libexec_PROGRAMS = \
cr-posix cr-gotcha cr-static \
read-posix read-gotcha read-static \
write-posix write-gotcha write-static \
writeread-posix writeread-gotcha writeread-static writeread-ftn \
writeread-posix writeread-gotcha writeread-static \
sysio-write-gotcha sysio-write-static \
sysio-read-gotcha sysio-read-static \
sysio-writeread-gotcha sysio-writeread-static sysio-writeread-posix \
Expand All @@ -14,6 +14,11 @@ libexec_PROGRAMS = \
app-btio-gotcha app-btio-static \
app-tileio-gotcha app-tileio-static

if HAVE_FORTRAN
libexec_PROGRAMS += \
writeread-ftn
endif

if HAVE_HDF5
libexec_PROGRAMS += \
app-hdf5-create-gotcha \
Expand All @@ -32,11 +37,13 @@ noinst_HEADERS = \
test_cppflags = $(AM_CPPFLAGS) $(MPI_CFLAGS) \
-I$(top_srcdir)/client/src -I$(top_srcdir)/common/src

if HAVE_FORTRAN
test_ftn_flags = $(AM_FCFLAGS) $(MPI_FFLAGS) \
-I$(top_srcdir)/client/src -I$(top_srcdir)/common/src
test_ftn_ldadd = $(top_builddir)/client/src/libunifycrf.la -lrt -lm $(FCLIBS)
test_ftn_ldflags = $(AM_LDFLAGS) $(MPI_FLDFLAGS) \
$(FLATCC_LDFLAGS) $(FLATCC_LIBS)
endif

test_gotcha_ldadd = $(top_builddir)/client/src/libunifycr_gotcha.la -lrt -lm
test_gotcha_ldflags = $(AM_LDFLAGS) $(MPI_CLDFLAGS) \
Expand Down Expand Up @@ -187,11 +194,6 @@ writeread_static_CPPFLAGS = $(test_cppflags)
writeread_static_LDADD = $(test_static_ldadd)
writeread_static_LDFLAGS = $(test_static_ldflags)

writeread_ftn_SOURCES = writeread.f90
writeread_ftn_FCFLAGS = $(test_ftn_flags)
writeread_ftn_LDADD = $(test_ftn_ldadd)
writeread_ftn_LDFLAGS = $(test_ftn_ldflags)

app_mpiio_gotcha_SOURCES = app-mpiio.c
app_mpiio_gotcha_CPPFLAGS = $(test_cppflags)
app_mpiio_gotcha_LDADD = $(test_gotcha_ldadd)
Expand Down Expand Up @@ -222,6 +224,15 @@ app_tileio_static_CPPFLAGS = $(test_cppflags)
app_tileio_static_LDADD = $(test_static_ldadd)
app_tileio_static_LDFLAGS = $(test_static_ldflags)

if HAVE_FORTRAN

writeread_ftn_SOURCES = writeread.f90
writeread_ftn_FCFLAGS = $(test_ftn_flags)
writeread_ftn_LDADD = $(test_ftn_ldadd)
writeread_ftn_LDFLAGS = $(test_ftn_ldflags)

endif

if HAVE_HDF5

app_hdf5_create_gotcha_SOURCES = app-hdf5-create.c
Expand Down

0 comments on commit a2a8e11

Please sign in to comment.