diff --git a/docs/build.txt b/docs/build.txt index 12dcc68b..9aec792a 100644 --- a/docs/build.txt +++ b/docs/build.txt @@ -1,9 +1,20 @@ -LaGriT executable is built using lagrit and lg_util libraries, and the external Exodus II libraries. +LaGriT uses Exodus II libraries, lg_util library and lagrit library. -Previous to this open source version, LaGriT has been compiled and run -on local machines including Linux RHEL, Linux Ubuntu, and Mac Mavericks, Mtn Lion +#################################################################### +Platform WIN7 with cygwin +#################################################################### -LaGriT uses Exodus II 6 libraries, lg_util library and lagrit library. +See build_win.txt and cmake-script in this directory. +May need development. + + +#################################################################### +Platforms Linux RHEL, Linux Ubuntu, and Mac OSX +#################################################################### + +These platforms have been compiled locally on Ubuntu. +Other platforms have not been compiled on newer OS. +May need development. See Makefile for lg_util library in lg_util/src See Makefile for lagrit library in lagrit/src @@ -12,7 +23,6 @@ See build scripts and README in lagrit/src --------------------------------------------- BUILD the BINARY: -#### ubuntu with modules ### USING BASH instead of TCSH ###### # GNU Fortran (Ubuntu 4.8.2-19ubuntu1) 4.8.2 # using ExodusII 6.09 shared libraries @@ -66,7 +76,7 @@ The exodus.pdf document describes EXNSET for nodes, but nothing for element sets code reference to EX_NODE_SET changed to EXNSET (defined in exodusII.inc) -------------------------------------------------------------------------- +#################################################################### Running LaGriT Run on command line in directory where files will be read and written. diff --git a/docs/build_win.txt b/docs/build_win.txt new file mode 100755 index 00000000..026c7767 --- /dev/null +++ b/docs/build_win.txt @@ -0,0 +1,283 @@ +************************* +Installing Cygwin +************************* + Get the latest version of Cygwin for your operating system + Download link: https://cygwin.com/install.html + + This guide is for the x86_64 setup file since its for 64 bit OS. + + The installation procedure with the setup file is straightforward. + My installation and download path: C:/Users/304285/dev/cygwin + Find the best mirror here: https://cygwin.com/mirrors.html + + Necessary libraries to install: + + a) zlib-devel + b) libhdf5-devel + c) libnetcdf-devel + d) libcurl-devel + + Helpful libraries to install: + + a) wget - helpful for downloading resources from url + b) git - another plugin for obtaining external resources + c) make - used by zlib, HDF5, NetCDF for building (make sure its GNU Make) + d) cmake - used by ExodusII + e) dos2unix - sometimes cygwin confuses Windows ecoding, use this binary on the file + Every now and then this wouldn't fix the issue unless forced 'dos2unix -f filename' + f) gzip - for unzipping .tar files with 'tar -zxvf' + g) curl - Web requests service mainly used by PHP, but ExodusII wants it too for some reason + + Compilers needed to install: + + a) gcc-core + b) gcc-fortran + c) gcc-g++ + + + **NOTE** Keep the setup file in your Cygwin directory as you can use it later to download additional packages and keep your cygwin directory updated. + + Extra Resources: + + GitHub + + 1) zlib-1.2.8 - https://github.com/madler/zlib + 2) HDF5-1.9.227 - https://github.com/live-clones/hdf5 + 3) NetCDF - https://github.com/Unidata/netcdf-c + +************************* +Getting the source +************************* + The following versions of libraries were used to compile LaGrit, if the devel versions of first three libraries were installed then these downloads might not be necessary: + + a) zlib-1.2.8 - from http://www.zlib.net/ + b) HDF5-1.8.15-patch1 - from https://www.hdfgroup.org/downloads/index.html + c) NetCDF-4.3.3.1.tar.gz - from http://www.unidata.ucar.edu/downloads/netcdf/index.jsp + d) ExodusII-6.09 - from http://sourceforge.net/projects/exodusii/files/ + f) LaGrit-3.2 + + **NOTE** Cygwin emulates a UNIX system, so all of the downloads can be normal .tar collections. This makes it easy to install the dependencies since we don't have to deal with Windows. Just make sure to get 64 bit downloads. + + **NOTE** This configuration also depends on what you use as your fortran, c++, and gcc compilers. You can add these variables to the ./configure commands without adding the word 'export', or you can set these as global variables in your .bashrc file(recommended). + + a) export FC="/bin/gfortran" + b) export CC="/bin/gcc" + c) export CXX="/bin/c++" + d) export FC90="/bin/gfortran" + e) export RANLIB="/bin/gcc-ranlib" + f) export AR="/bin/gcc-ar" + +************************* +Compiling zlib - Do not get if you downloaded zlib-devel from Cygwin package source, it comes with a static version of zlib +************************* + 1. Unpack zlib and navigate to the directory + + 2. Compile for Cygwin: + + ./configure --static --prefix=$HOME --64 + + 3. Type in 'make' and then make sure there is no errors with 'make check' + + 4. Use 'make install' to finish installing zlib + + 5. Use 'make clean' to clean up the library directory of build files. + +************************* +Compiling HDF5 - Use this to compile a static version of hdf5, otherwise libhdf5-devel is enough +************************* + 1. Unpack the tar source file, in it you should find a folder named release_docs, which contains installation instructions in file called INSTALL_Cygwin.txt I will follow these, while giving the actual commands I used. + + **NOTE** When you run the configure script, it might complain about new line characters. If this happens stop the script with Ctrl+C, and run 'dos2unix -f targetfile' on the file where it throws an error. Use 'make clean' afterwards to clean up your build. + + 2. In Hdf5 directory use the following command to configure the build script + + CFLAGS="-m64 -g" FCFLAGS="-m64 -g" CXXFLAGS="-m64 -g" ./configure --disable-shared --with-zlib=/cygdrive/c/Users/304285/dev/cygwin/home/304285/include,/cygdrive/c/Users/304285/dev/cygwin/home/304285/lib --prefix=$HOME --enable-fortran --enable-cxx --enable-static-exec + + CFLAGS="-m64 -g" FCFLAGS="-m64 -g" CXXFLAGS="-m64 -g" ./configure --disable-shared --with-zlib=/lib/libz.a --prefix=$HOME --enable-fortran --enable-cxx --enable-static-exec + + --host=x86_64-w64-mingw32 + --build=x86_64-w64-mingw32 + + --with-gnu-ld + + 3. Once configuration is complete, type in 'make' to build the library, and 'make check' to test it. + + 4. Run 'make install' and 'make check-install' to test it. + + 5. Run 'make clean' to clean up your library of build files. + +************************* +Compiling NetCDF - Use this to compile a static version of NetCDF, otherwise libnetcdf-devel is enough +************************* + **NOTE** After version 4.1.3, NetCDF-fortran became a different distribution so the use of environment variables set for fortran is unnecessary. + + 1. Unpack NetCDF and navigate to the directory, the installation instructions can be traced here: http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-install/ + + 2. Configure the build script + + CPPFLAGS="-I$HOME/include -m64 -g" LDFLAGS="-L$HOME/lib -m64 -g" LIBS="-L$HOME/lib -lhdf5_hl -lhdf5 -lz" ./configure --disable-shared --disable-dap --enable-netcdf-4 --prefix=$HOME CFLAGS="-m64 -g" + + **NOTE** Possibly helpful options: --build, --host + + 3. Build the library with 'make', and test it with 'make check' + + 4. Finish the install with 'make install' and 'make clean' + +************************* +Compiling Exodus +************************* + 1. Now before we start installing ExodusII, we need to make some slight modifications to NetCDF in $NETCDF_HOME/include/netcdf.h by changing the following variables as stated in exodus README file: + + a) #define NC_MAX_DIMS 65536 + b) #define NC_MAX_VARS 524288 + c) #define NC_MAX_VAR_DIMS 8 + + 2. Unpack Exodus and navigate to the exodus directory + + 3. Here we have two options for compiling ExodusII as described in the README, 1st is with Makefile.standalone, and 2nd is with cmake + + 1) Using Makefile.standalone (INCOMPLETE: Might need to add additional arguments): + + a) Use the following make command: + + make -f Makefile.standalone NETCDF=$HOME ARFLAGS=-rcv CFLAGS="-m64" FCFLAGS="-m64" CXXFLAGS="-m64" + + b) Copy the Exodus libararies to our local libraries + + cp libexodus.a libexoIIv2for.a $HOME/lib + + 2) Using cmake (Harder difficulty since requires manipulation of additional libs but completed): + + **NOTE** To be able to use cmake on my Cygwin installation I had to copy over my cmake executable from /bin/cmake to /home/304285/bin/cmake, and my cmake root files from /usr/share/cmake-3.1.2 to /home/304285/share/cmake-3.1.2. My PATH variable was set up to read my /home/304285/bin directory last and it overwrote the cmake I had in /bin/cmake. (Otherwise it throws "could not find CMAKE_ROOT/Module directory not found/Error executing cmake::LoadCache()") + + a) Run 'sh cmake-script' once you make appropriate changes to you cmake-script file, this was mine: + + EXTRA_ARGS=$@ + + # Fortran compiler + FC="/bin/gfortran" + + # Root to where netcdf and hdf5 libraries and includes + # are installed. Libraries will be in LIB_ROOT/lib and + # includes will be in LIB_ROOT/include + LIB_ROOT=/usr/local/lib + + # Root of where to install the exodus libraries and + # include files. Library will be in INSTALL_ROOT/lib + # and include file in INSTALL_ROOT/include + INSTALL_ROOT=$HOME + + # Complete path to where the exodus.py file should be installed + PYTHON_INSTALL=${INSTALL_ROOT}/python + + # Add the following for a static build, mine kept throwing me memory truncation error + # -DCMAKE_EXE_LINKER_FLAGS:STRING="-static" \ + + rm -f CMakeCache.txt + + cmake \ + -DBUILD_SHARED:BOOL=OFF \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_ROOT} \ + -DCMAKE_Fortran_COMPILER:FILEPATH=${FC} \ + -DNETCDF_NCDUMP:PATH='which ncdump' \ + -DNETCDF_INCLUDE_DIR:PATH=/usr/include \ + -DNETCDF_LIBRARY:PATH=/lib/libnetcdf.dll.a \ + -DHDF5HL_LIBRARY:PATH=/lib/libhdf5_hl.dll.a \ + -DHDF5_LIBRARY:PATH=/lib/libhdf5.dll.a \ + -DZLIB_LIBRARY:PATH=/lib/libz.dll.a \ + -DCURL_LIBRARY:PATH=/lib/libcurl.dll.a \ + -DPYTHON_INSTALL:PATH=${PYTHON_INSTALL} \ + -DCMAKE_C_FLAGS:STRING="-g -m64 -Dwin64 -mwindows" \ + -DCMAKE_CXX_FLAGS:STRING="-g -m64" \ + -DCMAKE_Fortran_FLAGS:STRING="-g -m64 -fcray-pointer -fdefault-integer-8 -Dwin64 -w -mwindows -fno-exceptions" \ + -DCMAKE_RANLIB:FILEPATH=/bin/gcc-ranlib \ + -DCMAKE_AR:FILEPATH=/bin/gcc-ar \ + -DCYGWIN:BOOL=TRUE \ + -DCMAKE_LEGACY_CYGWIN_WIN32=1 \ + -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \ + $EXTRA_ARGS + + b) There is a bug when it makes tests with static libraries, the following 2 files need to be changed for 'make' to work: + + 1) ../exodus-6.09/exodus/forbind/CMakeLists change line 56 and have ${HDF5HL_LIBRARY} come before ${HDF5_LIBRARY} + 2) ../exodus-6.09/exodus/cbind/CMakeLists change line 284 with the same library ordering + + c) Now run 'make' + + **NOTE** When compiling with static linker flags, make throws a truncating error, to fix this I have attempted many options in the cmake-script that are listed here, however in the end I just ended up not using "-static" as a linker flag: + + # -DCMAKE_GENERATOR:STRING="Unix Makefiles" \ + # -DCMAKE_LEGACY_CYGWIN_WIN32=1 \ + # -DCMAKE_Fortran_FLAGS:STRING="-g -fcray-pointer -fno-exceptions -fdefault-integer-8 -m64" \ + # -DCMAKE_STATIC_LINKER_FLAGS:STRING="-ncmodel=medium" \ + # --large-address-aware --relax --high-entropy-va + # -DCMAKE_EXE_LINKER_FLAGS:STRING="-static" \ + # -DCYGWIN:BOOL=TRUE \ + # -DCMAKE_LEGACY_CYGWIN_WIN32=1 \ + + d) To test your build use 'make check' + + **NOTE** After testing the build it throws a message about truncating to 32 bit. What causes this is probably the fact that floats on Windows 64 bit are 4 bit, while on Cygwin they are 8 bit since Cygwin emulated a Linux system. + + e) 'make install' + +************************* +Compiling lg_util +************************* + 1. Unpack the lg_util source and navigate to the src directory + + 2. Remove the previous header file and recreate it for your machine: + + rm -f mm2000.h + + $CC -E -m64 -Dwin64 mm2000_header.f -o mm2000.h + + mkdir objects_cygwin64_g_cygwin + + cp -p mm2000.h objects_cygwin64_g_cygwin/ + + 3. Build and install the library + + make install MOPT=64 COPT=-g LIBDIR=$HOME/lib COMPILER=cygwin + + **NOTE** In the Makefile, there is an ifeq(COMPILER=cygwin), in it CFLAGS are linked to my include folder in cygwin, readjust this as necessary. + + 4. Run ranlib on the lg_util libraries to fix archives (it appears to grab the wrong version from the path) + + $RANLIB $HOME/lib/util_* + + **NOTE** Use the following clean command to when rebuilding: + + make clean COMPILER=cygwin COPT=-g MOPT=64 LIBDIR=$HOME/lib + +************************* +Compiling lagrit +************************* +1. Unpack the lagrit source and navigate to the source dir + +2. Clean the directory up first by running these two commands, "rm *.o" and "rm *.mod" + +3. Build the lagrit library + + make lib MOPT=64 COPT=-g COMPILER=cygwin CFLAGS="-I$HOME/include" LIBDIR=$HOME/lib + +3. Build the lagrit executable with these commands: + + a) cp -f lagrit_cygwin.h lagrit.h + + b) cp -f machine_m64.h machine.h + + c) $FC -g -fcray-pointer -fdefault-integer-8 -m64 -Dwin64 -c -o lagrit_main.o lagrit_main.f + + d) $FC -g -fcray-pointer -fdefault-integer-8 -m64 -Dwin64 -c -o lagrit_fdate.o lagrit_fdate.f + + e) $FC -g -Dwin64 -fcray-pointer -fdefault-integer-8 -fno-sign-zero -o mylagrit objects_cygwin_g_cygwin/lagrit_main.o objects_cygwin_g_cygwin/lagrit_fdate.o lagrit_cygwin_g_cygwin.a /cygdrive/c/Users/304285/dev/cygwin/home/304285/lib/util_cygwin64_g_cygwin.a -L${HOME}/lib -lexoIIv2for -lexodus -L/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -lm -lstdc++ + + **NOTE** In the future add -static option before the -o in order to make a statically compiled executable + +4. Copy the .exe file and DLLs to a Windows system and run LaGrit! + + **NOTE** Use the following clean command to when rebuilding: + + make clean COMPILER=cygwin COPT=-g MOPT=64 LIBDIR=$HOME/lib diff --git a/docs/cmake-script b/docs/cmake-script new file mode 100755 index 00000000..13176d8e --- /dev/null +++ b/docs/cmake-script @@ -0,0 +1,54 @@ +EXTRA_ARGS=$@ + +# Fortran compiler +# FC=/opt/local/bin/gfortran-mp-4.8 + +# Root to where netcdf and hdf5 libraries and includes +# are installed. Libraries will be in LIB_ROOT/lib and +# includes will be in LIB_ROOT/include +LIB_ROOT=$HOME + +# Root of where to install the exodus libraries and +# include files. Library will be in INSTALL_ROOT/lib +# and include file in INSTALL_ROOT/include +INSTALL_ROOT=$HOME + +# Complete path to where the exodus.py file should be installed +PYTHON_INSTALL=${INSTALL_ROOT}/python + +rm -f CMakeCache.txt +# -DCMAKE_GENERATOR:STRING="Unix Makefiles" \ +# -DCURL_LIBRARY:PATH=/cygdrive/x/packages/Ubuntu-14.04-x86_64/anaconda-python/2.1.0/lib/libcurl.a \ +# -DCMAKE_LEGACY_CYGWIN_WIN32=1 \ +# -DCMAKE_Fortran_FLAGS:STRING="-g -fcray-pointer -fno-exceptions -fdefault-integer-8 -m64" \ +# -DCMAKE_STATIC_LINKER_FLAGS:STRING="-ncmodel=medium" \ +# --large-address-aware --relax --high-entropy-va +# -DCMAKE_EXE_LINKER_FLAGS:STRING="-static" \ +# -DCYGWIN:BOOL=TRUE \ +# -DCMAKE_LEGACY_CYGWIN_WIN32=1 \ + +cmake \ +-DBUILD_SHARED:BOOL=OFF \ +-DBUILD_SHARED_LIBS:BOOL=OFF \ +-DCMAKE_EXE_LINKER_FLAGS:STRING="-static" \ +-DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_ROOT} \ +-DCMAKE_Fortran_COMPILER:FILEPATH=${FC} \ +-DNETCDF_NCDUMP:PATH='which ncdump' \ +-DNETCDF_INCLUDE_DIR:PATH=${LIB_ROOT}/include \ +-DNETCDF_LIBRARY:PATH=${LIB_ROOT}/lib/libnetcdf.a \ +-DHDF5HL_LIBRARY:PATH=${LIB_ROOT}/lib/libhdf5_hl.a \ +-DHDF5_LIBRARY:PATH=${LIB_ROOT}/lib/libhdf5.a \ +-DZLIB_LIBRARY:PATH=${LIB_ROOT}/lib/libz.a \ +-DCURL_LIBRARY:PATH=/cygdrive/x/swdev/packages/Ubuntu-14.04-x86_64/anaconda-python/2.1.0/lib/libcurl.a \ +-DPYTHON_INSTALL:PATH=${PYTHON_INSTALL} \ +-DCMAKE_C_FLAGS:STRING="-g -m64" \ +-DCMAKE_CXX_FLAGS:STRING="-g -m64 -fcray-pointer" \ +-DCMAKE_Fortran_FLAGS:STRING="-g -m64 -fcray-pointer -fdefault-integer-4" \ +-DCMAKE_RANLIB:FILEPATH=/bin/gcc-ranlib \ +-DCMAKE_AR:FILEPATH=/bin/gcc-ar \ +-DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \ +$EXTRA_ARGS + + + + diff --git a/lg_util/src/Makefile b/lg_util/src/Makefile index ec39d633..3b697cc2 100755 --- a/lg_util/src/Makefile +++ b/lg_util/src/Makefile @@ -45,6 +45,7 @@ # # Note: assumes Makefile and Makefile.depends # +# Modified Aug 2016 by tamiller@lanl.gov to add mikita cygwin work # Modified Mar 2015 by tamiller@lanl.gov to use 64bit as default # Modified Mar 2015 by tamiller@lanl.gov to include Ubuntu # Modified Nov 2010 by tamiller@lanl.gov to use gfortran as default @@ -110,6 +111,21 @@ endif FF90FLAGS = $FFLAGS endif +# Cygwin ------------------------------- +ifeq ($(COMPILER), cygwin) +# SUFFC = _cygwin +FC = /bin/gfortran +CC = /bin/gcc +CXX = /bin/c++ +FC90 = /bin/gfortran + +OSTAG = _cygwin + +FFLAGS = -g -fcray-pointer -fdefault-integer-8 -m64 -Dwin64 +FF90FLAGS = -g -fcray-pointer -fdefault-integer-8 -m64 -Dwin64 +CFLAGS = -g -m64 -Dwin64 -I/cygdrive/c/Users/304285/dev/cygwin/usr/include +endif + # # Mac OSX ------------------------------ # Absoft9.5+ should not need flags @@ -159,7 +175,6 @@ COPT = -O endif # # form the name suffix based on platform and flags -# default optimized 32 bit SUFF = $(OSTAG)_o ifeq ($(MOPT), 64) SUFF = $(OSTAG)64_o @@ -178,6 +193,9 @@ endif ifeq ($(COMPILER),ABSOFT) SUFFC = _absoft endif +ifeq ($(COMPILER),cygwin) +SUFF2 = _cygwin +endif # OBJDIR = objects$(SUFF)$(SUFFC)/ LIB = $(PROJ)$(SUFF)$(SUFFC).a diff --git a/lg_util/src/README b/lg_util/src/README index 2ac5f384..0e125417 100755 --- a/lg_util/src/README +++ b/lg_util/src/README @@ -1,9 +1,26 @@ +lg_util library This library includes general memory management, algorithm, and io routines used by LaGriT. See mm2000.F for a list of the memory routines. These files are seldom changed and compile into the lib_util_$OS.a library. -See Versions.txt for changes before LaGriT open source. +Versions.txt for summary of changes and dates. + +==================================================== +Sample compile + + make MOPT=64 COPT=-g lib + +CAUTION: the preprocessor for mm2000.h is not working +on the mac platforms correctly. +Workaround ... just copy mm2000_m64.h to mm2000.h + + rm -f mm2000.h + gcc -E -m64 -Dlinx64 mm2000_header.F -o mm2000.h + + [ or cp mm2000_m64.h to mm2000.h] +==================================================== + Makefile ########################################################################## @@ -61,20 +78,3 @@ Makefile # Created Jan 7 2008 by tamiller@lanl.gov # Modified Nov 2010 by tamiller@lanl.gov to use gfortran as default # - - -==================================================== -CAUTION: the preprocessor for mm2000.h is not working -on the mac platforms correctly. -Workaround ... just copy mm2000_m64.h to mm2000.h - -Sample compile - -rm -f mm2000.h -gcc -E -m64 -Dlinx64 mm2000_header.F -o mm2000.h - -[ or cp mm2000_m64.h to mm2000.h] - -make MOPT=64 COPT=-g lib -==================================================== - diff --git a/lg_util/src/Versions.txt b/lg_util/src/Versions.txt index 1435d3fc..a7097240 100644 --- a/lg_util/src/Versions.txt +++ b/lg_util/src/Versions.txt @@ -1,4 +1,12 @@ +======================================================================= +LaGriT V3.2 for open source + +Sep 1 2016 +Add changes from Mikita Yanki summer student compile on WIN7 with cygwin +local /n/swdev/LAGRIT/lucia/mikita_windows_backup/304285_bak2/dev/libs/lg_util/src +Makefile and opsys.h updated to cygwin option + ======================================================================= LaGriT V3.108 from https://ancho.lanl.gov/lagrit/hg/lg_util diff --git a/lg_util/src/mm2000.h b/lg_util/src/mm2000.h index 6acc7973..fea71e79 100644 --- a/lg_util/src/mm2000.h +++ b/lg_util/src/mm2000.h @@ -125,7 +125,6 @@ CPVCS Initial revision. -# 172 "opsys.h" @@ -134,6 +133,10 @@ CPVCS Initial revision. + +# 181 "opsys.h" + +# 193 "opsys.h" diff --git a/lg_util/src/opsys.h b/lg_util/src/opsys.h index febae3d8..1dd59962 100755 --- a/lg_util/src/opsys.h +++ b/lg_util/src/opsys.h @@ -154,6 +154,14 @@ #endif /**** win ****/ +#ifdef win64 +#define FCV_UNDERSCORE +#define SIZEOF_INT 4 +#define SIZEOF_LONG 8 +#define SIZEOF_VOIDP 8 +#define MAX_UINT 18446744073709551615.00 +#endif + /**** sgi ****/ /**** default 32 bit ****/ @@ -173,10 +181,16 @@ #if SIZEOF_INT == SIZEOF_VOIDP #define int_ptrsize int #elif SIZEOF_LONG == SIZEOF_VOIDP +#ifdef win64 +#define int_ptrsize long long +#else #define int_ptrsize long +#endif #else #error "Unknown case for size of pointer." #endif + + /* end file opsys.h */ diff --git a/src/Makefile b/src/Makefile index c99c05cf..45e3430f 100755 --- a/src/Makefile +++ b/src/Makefile @@ -92,6 +92,21 @@ GCCV = $(shell gcc -dumpversion ) SUFFC = _gf$(GCCV) endif +ifeq ($(COMPILER), cygwin) +SUFFC = _cygwin +FC = /bin/gfortran +CC = /bin/gcc +CXX = /bin/c++ +FC90 = /bin/gfortran + +OSTAG = _cygwin + +FFLAGS = -fcray-pointer -fdefault-integer-8 -m64 -Dwin64 +FF90FLAGS = -fcray-pointer -fdefault-integer-8 -m64 -Dwin64 +CFLAGS = -m64 -Dwin64 +# -I/usr/include +endif + ifeq ($(COMPILER),ABSOFT) FC = f77 FC90 = f90 @@ -280,7 +295,8 @@ install: lagrit.h $(OBJDIR) $(F90_OBJS) $(F77_OBJS) $(F77C_OBJS) $(C_OBJS) $(CXX head -3 lagrit.h @echo "Done $@ $(LIB) $(LIBDIR)" # -clean:; @rm -f $(OBJDIR)*.o $(OBJDIR)*.mod +clean:; rm -f $(OBJDIR)*.o $(OBJDIR)*.mod + rm -f *.o *.mod # clobber:; -rm -fr objects_* *.a # @@ -367,8 +383,8 @@ $(OBJDIR)%.o : %.f # cp lagrit$(OSTAG).h lagrit.h # cat lagrit.h -.SUFFIXES: .f90 -$(F90_OBJS): $(OBJDIR)%.o: %.f90 +.SUFFIXES: .f90 .mod +$(F90_OBJS): $(OBJDIR)%.o: %.f90 ColoredGraphModule.mod GraphModule.mod LowPassFilterModule.mod $(FC90) $(COPT) $(FF90FLAGS) -c $< -o $@ $(OBJDIR)%.o : %.c @@ -377,6 +393,10 @@ $(OBJDIR)%.o : %.c $(OBJDIR)%.o : %.cpp $(CXX) $(COPT) $(CFLAGS) -c -o $@ $< +%.mod : %.f90 + $(FC) $(COPT) $(FFLAGS) -c $< -o $(OBJDIR)$@ + + # this is commented out due to platform issues # cp machine_m64.h machine.h or machine_m32.h #machine.h : machine_header.h diff --git a/src/README b/src/README index ec33df91..74bbab39 100755 --- a/src/README +++ b/src/README @@ -1,5 +1,6 @@ -This directory contains LaGriT source .f, .f90, and .c files -There are include files .h, .csh, and lagrit*.h files for OS and date tags. +This directory contains LaGriT source fortran and C files. +The include file lagrit.h sets OS and date tags for the banner. +The lagrit*.h files are OS versions that are copied to lagrit.h To build, use Makefile, Makefile.depends type 'make help' to see a listing of make options @@ -18,11 +19,10 @@ Build scripts for compiler flags and names include: buildbin.scr - SunOS, Linux, and Darwin (mac) go.scr - single set of commands to compile for Ubuntu linux -Note: lagrit.h has tags that can be used to set program OS and DATE tags. -This directory contains lagrit_lin.h, lagrit_mac.h, lagrit_sun.h -which are used at compile time to update these tags. The file -lagrit.template.h preserves the template for these files. Modify -lagrit.h to define your own tags for the LaGriT runtime banner. +============================================================== +V3.2 includes recent updates for WINDOWS with cygwin +See general instructions in /docs/build* and cmake* +and local README and scripts in this directory. ============================================================== LIBRARIES: lg_util (included) and ExodusII (external) diff --git a/src/copyrite.h b/src/copyrite.h index d05f00a8..bed8f84b 100644 --- a/src/copyrite.h +++ b/src/copyrite.h @@ -20,7 +20,7 @@ C LACC #: LA-CC-15-069 C Copyright Number Assigned: C15097 C C ###################################################################### -C LaGriT Version 3 LACC-2012-084 +C LaGriT Version 3 LACC-2012-084 for open distribution C C Copyright Notice: This program was prepared by Los Alamos National C Security, LLC at Los Alamos National Laboratory (LANL) under contract @@ -33,7 +33,7 @@ C warranty, express or implied, or assumes any liability or responsibility C for the use of this software. C C ###################################################################### -C 2007 LaGriT Version 2.0 LA-CC number: 07-038 +C 2007 LaGriT Version 2.0 LA-CC number: 07-038 for open distribution C C Copyright Notice: This program was prepared by Los Alamos National C Security, LLC at Los Alamos National Laboratory (LANL) under contract diff --git a/src/exo_put_sets.c b/src/exo_put_sets.c index 409866ba..ede851b9 100644 --- a/src/exo_put_sets.c +++ b/src/exo_put_sets.c @@ -16,10 +16,10 @@ extern "C" { #endif -#define EXCHECK(funcall,errmsg)\ - if ( (funcall) < 0 ) \ - { \ - fprintf( stderr, errmsg ); \ +#define EXCHECK(funcall,errmsg)\ + if ( (funcall) < 0 ) \ + { \ + fprintf( stderr, errmsg ); \ } void exo_put_sets_(const int_ptrsize *idexo, const int_ptrsize *type, @@ -47,7 +47,7 @@ void exo_put_sets_(const int_ptrsize *idexo, const int_ptrsize *type, this_set.num_entry = *nentry; this_set.num_distribution_factor = *num_df; this_set.entry_list = &set_array; - this_set.extra_list = NULL; + this_set.extra_list = NULL; this_set.distribution_factor_list = NULL; // Put the set to the data structure diff --git a/src/go.scr b/src/go.scr index 00dc1ffe..f5599a20 100644 --- a/src/go.scr +++ b/src/go.scr @@ -19,7 +19,7 @@ gfortran -g -fcray-pointer -fdefault-integer-8 -m64 -Dlinx64 -c -o lagrit_main gfortran -g -fcray-pointer -fdefault-integer-8 -m64 -Dlinx64 -c -o lagrit_fdate.o lagrit_fdate.f ### leave off static for .so shared libraries: -gfortran -g -Dlinx64 -fcray-pointer -fdefault-integer-8 -fno-sign-zero -o mylagrit lagrit_main.o lagrit_fdate.o lagrit_ulin64_o_gf4.8.a /n/swdev/LAGRIT/VERS_3.108_016_AUG/lagrit/lg_util/src/util_ulin64_o_gf4.8.a -L/n/swdev/packages/Ubuntu-14.04-x86_64/exodusii/6.09/gcc-4.8.2-serial/lib -lexodus -lexoIIv2for -lnetcdf -lhdf5_hl -lhdf5 -lz -lm -lstdc++ +gfortran -g -Dlinx64 -fcray-pointer -fdefault-integer-8 -fno-sign-zero -o mylagrit lagrit_main.o lagrit_fdate.o lagrit_ulin64_o_gf4.8.a ../lg_util/src/util_ulin64_o_gf4.8.a -L/n/swdev/packages/Ubuntu-14.04-x86_64/exodusii/6.09/gcc-4.8.2-serial/lib -lexodus -lexoIIv2for -lnetcdf -lhdf5_hl -lhdf5 -lz -lm -lstdc++ exit @@ -36,7 +36,7 @@ gfortran -g -fcray-pointer -fdefault-integer-8 -m64 -Dlinx64 -c -o lagrit_fdat cp dumpexodusII.f dumpexodusII.f.withexo cp dumpexodusII.f.withnoexo dumpexodusII.f -gfortran -g -Dlinx64 -static -fcray-pointer -fdefault-integer-8 -fno-sign-zero -o mylagrit_noexo lagrit_main.o lagrit_fdate.o lagrit_ulin64_g_gf4.8.a /n/swdev/LAGRIT/VERS_3.103_015_MAR/lg_util/src/util_ulin64_g_gf4.8.a -L -lm -lstdc++ +gfortran -g -Dlinx64 -static -fcray-pointer -fdefault-integer-8 -fno-sign-zero -o mylagrit_noexo lagrit_main.o lagrit_fdate.o lagrit_ulin64_g_gf4.8.a ../lg_util/src/util_ulin64_g_gf4.8.a -L -lm -lstdc++ exit diff --git a/src/machine_header.h b/src/machine_header.h index 3b3bef01..3234b19f 100644 --- a/src/machine_header.h +++ b/src/machine_header.h @@ -66,6 +66,13 @@ C Default name mangle scheme #endif /**** win ****/ +#ifdef win64 +#define FCV_UNDERSCORE +#define SIZEOF_INT 4 +#define SIZEOF_LONG 8 +#define SIZEOF_VOIDP 8 +#endif + /**** sgi ****/ /**** default 32 bit ****/ diff --git a/src/type_sizes.h b/src/type_sizes.h index 7bf3ae26..3bcc39e5 100644 --- a/src/type_sizes.h +++ b/src/type_sizes.h @@ -1,60 +1,67 @@ -#ifndef TYPE_SIZES_H_INCLUDED -#define TYPE_SIZES_H_INCLUDED - -/* LaGriT assumes that the size of an integer is the same size as a - * pointer. Use the preprocessor and configure settings to select - * the integer type so that it matches the size of a pointer. - */ - -/**** linux 32 ****/ -#ifdef lin -#define FCV_UNDERSCORE -#define SIZEOF_INT 4 -#define SIZEOF_LONG 4 -#define SIZEOF_VOIDP 4 -#endif - -/**** linux x64 ****/ -#ifdef linx64 -#define FCV_UNDERSCORE -#define SIZEOF_INT 4 -#define SIZEOF_LONG 8 -#define SIZEOF_VOIDP 8 -#endif - -/**** Mac 32 ****/ -#ifdef mac -#define SIZEOF_INT 4 -#define SIZEOF_LONG 4 -#define SIZEOF_VOIDP 4 -#endif - -/**** Mac x64 ****/ -#ifdef macx64 -#define SIZEOF_INT 4 -#define SIZEOF_LONG 8 -#define SIZEOF_VOIDP 8 -#endif - -/****** win 64 ******/ -#ifdef win64 -#define FCV_UNDERSCORE -#define SIZEOF_INT 4 -#define SIZEOF_LONG 8 -#define SIZEOF_VOIDP 8 -#endif - - -#if SIZEOF_INT == SIZEOF_VOIDP -#define int_ptrsize int -#elif SIZEOF_LONG == SIZEOF_VOIDP -#ifdef win64 -#define int_ptrsize long long -#else -#define int_ptrsize long -#endif -#else -#error "Unknown case for size of pointer." -#endif - -#endif /* TYPE_SIZES_H_INCLUDED */ +#ifndef TYPE_SIZES_H_INCLUDED +#define TYPE_SIZES_H_INCLUDED + +/* LaGriT assumes that the size of an integer is the same size as a + * pointer. Use the preprocessor and configure settings to select + * the integer type so that it matches the size of a pointer. + */ + +/**** linux 32 ****/ +#ifdef lin +#define FCV_UNDERSCORE +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_VOIDP 4 +#endif + +/**** linux x64 ****/ +#ifdef linx64 +#define FCV_UNDERSCORE +#define SIZEOF_INT 4 +#define SIZEOF_LONG 8 +#define SIZEOF_VOIDP 8 +#endif + +/**** Mac 32 ****/ +#ifdef mac +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_VOIDP 4 +#endif + +/**** Mac x64 ****/ +#ifdef macx64 +#define SIZEOF_INT 4 +#define SIZEOF_LONG 8 +#define SIZEOF_VOIDP 8 +#endif + +/****** win 64 ******/ +#ifdef win64 +#define FCV_UNDERSCORE +#define SIZEOF_INT 4 +#define SIZEOF_LONG 8 +#define SIZEOF_VOIDP 8 +#endif + + /****** Cygwin ****** +#ifdef __CYGWIN__ +#define FCV_UNDERSCORE +#define SIZEOF_INT 4 +#define SIZEOF_LONG 4 +#define SIZEOF_VOIDP 8 +#endif ***/ + +#if SIZEOF_INT == SIZEOF_VOIDP +#define int_ptrsize int +#elif SIZEOF_LONG == SIZEOF_VOIDP +#ifdef win64 +#define int_ptrsize long long +#else +#define int_ptrsize long +#endif +#else +#error "Unknown case for size of pointer." +#endif + +#endif /* TYPE_SIZES_H_INCLUDED */