Commit 0896521b authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Compile with OpenMP, if available

parent a30087ec
AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4
AM_CFLAGS = @AM_CFLAGS@
AM_LDFLAGS = -L$(libdir) -Wl,-rpath -Wl,$(libdir) @AM_LDFLAGS@
AM_CFLAGS = @AM_CFLAGS@ $(OPENMP_CFLAGS)
AM_LDFLAGS = -L$(libdir) -Wl,-rpath -Wl,$(libdir) @AM_LDFLAGS@ $(OPENMP_CFLAGS)
AM_FCFLAGS = @AM_FCFLAGS@ $(OPENMP_FCFLAGS)
# libraries
lib_LTLIBRARIES = libftimings-@FTIMINGS_API_VERSION@-@FC@.la
......
......@@ -6,11 +6,17 @@ AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_LANG([C])
AM_PROG_CC_C_O
AC_OPENMP
AC_LANG([Fortran])
AC_PROG_FC
AC_FC_LIBRARY_LDFLAGS
AC_FC_FREEFORM
AC_OPENMP
LT_INIT
......@@ -19,6 +25,7 @@ PKG_PROG_PKG_CONFIG
AC_SUBST([FTIMINGS_SO_VERSION], [0:1:0])
AC_SUBST([FTIMINGS_API_VERSION], [0.1])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_FCFLAGS])
AC_SUBST([AM_LDFLAGS])
AC_CONFIG_FILES([Makefile
......
......@@ -34,12 +34,14 @@ program test_timings
write(*,*) "Iteration", i
call timer%start("cycle", replace=.true.)
!$ call timer%start("parallel")
!$omp parallel do
do j = 1,3
do j = 1,30
call a()
call b()
end do
!$omp end parallel do
!$ call timer%stop("parallel")
call timer%stop("cycle")
if (timer%is_enabled()) then
......@@ -55,7 +57,11 @@ program test_timings
write(*,'(a,f9.6)') " c part: ", timer%in_entries("c") / timer%get("program", "cycle")
write(*,'(a,f9.6)') " b part: ", timer%in_entries("b") / timer%get("program", "cycle")
write(*,'(a,f9.6)') " cycle total : ", timer%get("program", "cycle")
#ifndef _OPENMP
write(*,'(a,f9.6)') " cycle -> a -> b -> c : ", timer%get("program", "cycle", "a", "b", "c")
#else
write(*,'(a,f9.6)') " cycle -> a -> b -> c : ", timer%get("program", "cycle", "parallel", "a", "b", "c")
#endif
write(*,*)
endif
end do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment