Skip to content

Commit

Permalink
testing code
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Jul 26, 2012
1 parent 00531ec commit 557b769
Show file tree
Hide file tree
Showing 14 changed files with 389 additions and 114 deletions.
5 changes: 5 additions & 0 deletions .gitignore
@@ -0,0 +1,5 @@
OBJ
.*~
*~
config.log
stamp-h
58 changes: 20 additions & 38 deletions Build.in
Expand Up @@ -8,42 +8,25 @@ HAVE_FDEPEND := @have_fdepend@

include $(TOPDIR)cmplrflags.mk

EXEC := mpiio
LIBS := @LIBS@

ifneq ($(TACC_HDF5_LIB),)
ifneq ($(TACC_SZIP_LIB),)
SZIP_LIBS := -L$(TACC_SZIP_LIB) -lsz
endif
ifneq ($(wildcard $(TACC_HDF5_LIB)/libsz.so),)
SZIP_LIBS := -lsz
endif
override LIBS := $(LIBS) -L$(TACC_HDF5_LIB) -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lz
override FFLAGS := $(FFLAGS) -I$(TACC_HDF5_INC) -DUSE_HDF5
override FCFLAGS := $(FCFLAGS) -I$(TACC_HDF5_INC) -DUSE_HDF5
endif
LIBRARY := libt3pio.a
LIBS := @LIBS@

VPATH := $(TOPDIR)src


F_SRC := \
assert.F90 \
cmdline.F90 \
grid.F90 \
master.F90 \
parallel.F90 \
writer.F90 \
F_SRC := f_t3pio.f90


C_SRC := \
measure.c \
f2c_internal.c \
pfs.c \
t3pio.c \


SRC := $(F_SRC) $(C_SRC)


OBJ := $(patsubst %.F90, %.o, $(F_SRC)) \
OBJ := $(patsubst %.f90, %.o, $(F_SRC)) \
$(patsubst %.c, %.o, $(C_SRC))

TAGLIST := Makefile cmplrflags.mk $(foreach f, $(SRC), src/$(f))
Expand All @@ -53,15 +36,20 @@ TAGLIST := Makefile cmplrflags.mk $(foreach f, $(SRC), src/$(f))
all: config.status
$(MAKE) -f build.mk HAVE_SRC_BUILT=yes _all

_all: $(EXEC)
_all: $(LIBRARY)

$(LIBRARY) : $(OBJ)
$(AR) $(ARFLAGS) $@ $(OBJ)
-$(RANLIB) $@

tst: $(LIBRARY) tst.o
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ tst.o -L. -lt3pio -lm


$(EXEC) : $(OBJ)
$(LINK.F) -o $@ $(OBJ) $(LIBS) -lm
if [ -d $(SCRATCH)/mpiio/ ]; then mkdir -p $(SCRATCH)/mpiio/$(TARG); cp $(EXEC) $(SCRATCH)/mpiio/$(TARG); fi

echo:
@echo F_SRC: $(F_SRC)
@echo libsz: $(wildcard $(TACC_HDF5_LIB)/libsz.so)
@echo OBJ: $(OBJ)

neat:
$(RM) .*~ *~ src/*~ src/.*~

Expand Down Expand Up @@ -106,9 +94,6 @@ tags:
etags `cat file_list.2`
$(RM) file_list.*

depend:
cd $(TOPDIR)/src; fdepend --ignore mpi --ignore hdf5 $(F_SRC) > $(TOPDIR).depend

config.h: stamp-h

stamp-h: $(TOPDIR)config.h.in config.status
Expand All @@ -120,12 +105,9 @@ build.mk:: $(TOPDIR)Build.in config.status
config.status: $(TOPDIR)configure
cd $(TOPDIR) && $(O_DIR)config.status --recheck

ifeq ($(HAVE_SRC_BUILT),yes)
include $(patsubst %.c, %.d, $(C_SRC))
ifeq ($(HAVE_FDEPEND),yes)
include $(patsubst %.F90, %.d, $(F_SRC))
endif
endif
f_t3pio.mod f_t3pio.o : f_t3pio.f90
include $(patsubst %.c, %.d, $(C_SRC))


# Local Variables:
# mode: makefile-gmake
Expand Down
24 changes: 24 additions & 0 deletions Makefile
@@ -0,0 +1,24 @@
.SUFFIXES:
.SUFFIXES:

SRCDIR := $(CURDIR)/

ifneq ($(TARG),)
override TARG := $(TARG)/
override TARG := $(subst //,/,$(TARG))
override O_DIR := $(TARG)
else
TARG := OBJ/
O_DIR := OBJ/
endif

MYMAKE.targ = +@[ -f $(TARG)build.mk ] || F77=mpif90 CC=mpicc ./configure ; \
MyMakeCmd="$(MAKE) -C $(TARG) -f build.mk -I $(SRCDIR) TOPDIR=$(SRCDIR) O_DIR=$(SRCDIR)$(O_DIR)" ; \
echo $$MyMakeCmd $@; \
$$MyMakeCmd

all::

%:
$(MYMAKE.targ) $@

18 changes: 18 additions & 0 deletions aclocal.m4
@@ -0,0 +1,18 @@
dnl
dnl *************************************************************************
dnl
AC_DEFUN(PP_SET_OUTPUT_DIR_BY_CMD,
[
pp_output_dir=`$1`
AC_MSG_CHECKING([for output directory: $pp_output_dir])
if test "x$pp_output_dir" = "x"; then
pp_output_dir='.'
fi
if test ! -d $pp_output_dir; then
AC_MSG_RESULT([not found, making it])
mkdir -p $pp_output_dir
else
AC_MSG_RESULT([yes])
fi
CONFIG_STATUS=${CONFIG_STATUS="./$pp_output_dir/config.status"}
])
112 changes: 112 additions & 0 deletions cmplrflags.mk
@@ -0,0 +1,112 @@
.SUFFIXES:
.SUFFIXES: .c .d .h .o

ifeq ($(compiler),)
ifneq ($(TARG_COMPILER_FAMILY),)
compiler := $(TARG_COMPILER_FAMILY)
endif
endif

ifeq ($(METHOD),)
ifneq ($(TARG_METHOD),)
METHOD := $(TARG_METHOD)
endif
endif

DEPENDENCY_FLAG := -MM
RANLIB := ranlib
########################################################################
OPTNAME := opt
ifneq (,$(findstring x86_64-linux-gnu,$(MACHINE)-$(OS)))

ifeq ($(compiler),lonestar)
compiler := intel
endif

ifeq ($(compiler),)
compiler := intel
endif


ifeq ($(compiler),intel)
FC := mpif90
CC := mpicc
OPTLVL := -g -O3 -xHost
ifeq ($(METHOD),dbg)
F_OPTLVL :=
OPTLVL := -g -O0 -traceback -DDEBUG
OPTNAME := dbg
endif
ifeq ($(METHOD),mdbg)
F_OPTLVL := -CB -check uninit -fpe0 -check arg_temp_created -check pointers
OPTLVL := -g -O0 -traceback -DDEBUG
OPTNAME := mdbg
endif
COMMON_FLGS := $(OPTLVL) $(F_OPTLVL)
IMODS := -module
endif


ifeq ($(compiler),pgi)
FC := mpif90
CC := mpicc
OPTLVL := -gopt -tp barcelona-64 -fast
ifeq ($(METHOD),dbg)
F_OPTLVL :=
OPTLVL := -g -O0 -DDEBUG
OPTNAME := dbg
endif
ifeq ($(METHOD),mdbg)
F_OPTLVL :=
OPTLVL := -g -O0 -DDEBUG
OPTNAME := mdbg
endif
COMMON_FLGS := $(OPTLVL) $(F_OPTLVL) $(EPPFLAG) -Mfree
IMODS := -module
endif

ifeq ($(compiler),gcc)
FC := mpif90
CC := mpicc
COMMON_FLGS := -g -O0 $(PRECISION) -ffree-form -DNDEBUG -ffree-line-length-none
endif
endif


########################################################################
# Compiler flags for apple
#
ifneq (,$(findstring x86_64-darwin,$(MACHINE)-$(OS)))
FC := mpif90
CC := mpicc
OPTLVL := -O2
ifeq ($(METHOD),dbg)
OPTNAME := dbg
OPTLVL := -g -O0
F_OPTLVL :=
endif
ifeq ($(METHOD),mdbg)
OPTNAME := mdbg
OPTLVL := -g -O0 -fbounds-check
F_OPTLVL :=
endif
COMMON_FLGS := $(F_OPTLVL) $(OPTLVL) $(EPPFLAG) $(PRECISION) -ffree-form $(PETSC_FLAGS) -ffree-line-length-none

endif


override FFLAGS := $(FFLAGS) $(COMMON_FLGS) $(FC_FLAGS)
override CFLAGS := $(CFLAGS) $(OPTLVL) -I$(TOPDIR)/src

%.o %.mod : %.f90
$(COMPILE.F) -I $(O_DIR) -o $(O_DIR)$(*F).o $<

%.o : %.c
$(COMPILE.c) -I $(O_DIR) -o $(O_DIR)$(*F).o $<

%.d: %.c
$(SHELL) -c '$(CC) $(CFLAGS) -I. $(DEPENDENCY_FLAG) $< \
| sed -e '\''s|/[^ ][^ ]*/||g'\'' \
-e '\''s|mpi.h||g'\'' \
-e '\''s|mpio.h||g'\'' \
> $@; [ -s $@ ] || rm -f $@'
69 changes: 69 additions & 0 deletions config.h.in
@@ -0,0 +1,69 @@
/* config.h.in. Generated from configure.ac by autoheader. */

/* Define to dummy `main' function (if any) required to link to the Fortran
libraries. */
#undef F77_DUMMY_MAIN

/* Define to a macro mangling the given C identifier (in lower and upper
case), which must not contain underscores, for linking with Fortran. */
#undef F77_FUNC

/* As F77_FUNC, but for C identifiers containing underscores. */
#undef F77_FUNC_

/* Define if F77 and FC dummy `main' functions are identical. */
#undef FC_DUMMY_MAIN_EQ_F77

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the `lustreapi' library (-llustreapi). */
#undef HAVE_LIBLUSTREAPI

/* Define to 1 if you have the <lustre/liblustreapi.h> header file. */
#undef HAVE_LUSTRE_LIBLUSTREAPI_H

/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H

/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H

/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H

/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H

/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H

/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H

/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H

/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

/* Define to the full name of this package. */
#undef PACKAGE_NAME

/* Define to the full name and version of this package. */
#undef PACKAGE_STRING

/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME

/* Define to the home page for this package. */
#undef PACKAGE_URL

/* Define to the version of this package. */
#undef PACKAGE_VERSION

/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

0 comments on commit 557b769

Please sign in to comment.