From f2bb49ba68c5edfb215cf732c27d4497ccdab007 Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Wed, 26 Jun 2024 17:57:56 -0400 Subject: [PATCH 01/11] Create objects.mk and dependency.mk using only sh script and add windows compatibility files --- ED/build/shell/build_objects.sh | 36 + ED/src/include/dirent_win.h | 1239 +++++++++++++++++++++++++++++++ ED/src/utils/utils_c.c | 6 +- Makefile.am | 32 + 4 files changed, 1312 insertions(+), 1 deletion(-) create mode 100644 ED/build/shell/build_objects.sh create mode 100644 ED/src/include/dirent_win.h create mode 100644 Makefile.am diff --git a/ED/build/shell/build_objects.sh b/ED/build/shell/build_objects.sh new file mode 100644 index 000000000..62a29634a --- /dev/null +++ b/ED/build/shell/build_objects.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Add your build commands here +SOURCES=$( (cd ../../.. && find ED/src -name "*.[Ff]90" -and -not -path "ED/src/preproc/*")) + +# Remove ED/src/driver/edmain.F90 from OBJECTS +SOURCES=$(echo $SOURCES | sed 's/ED\/src\/driver\/edmain.F90//') + +echo SOURCES = $SOURCES ED/src/utils/utils_c.c > sources.mk + +rm -f dependency.mk + +# Build dependency rules for object files +for src in $SOURCES; do + # Mod depends on the source file building + SRC_MOD_NAME=$(echo $(basename "${src%.[Ff]90}.mod")) + echo $SRC_MOD_NAME: ${src%.[Ff]90}.o >> dependency.mk + + # Find modules used in the source file and add as dependency for the object file + MODS_USED=$(cd ../../.. && grep -i '^\s*use\s\+' $src | awk '{print $2}' | sed 's/,.*//' | sort | uniq) + + # Update MODS_USED to include only modules that has a corresponding + # source file with the pattern ED/src/*/$mod.[Ff]90 + MODS_USED=$(for mod in $MODS_USED; do + if [ -f ../../../ED/src/*/$mod.F90 -o -f ../../../ED/src/*/$mod.f90 ]; then + echo $mod + fi + done) + + MODS_USED_MOD=$(for line in $MODS_USED; do echo -n "$line.mod "; done) + + length=$(echo $MODS_USED_MOD | wc -w) + if [ $length -gt 0 ]; then + echo ${src%.[Ff]90}.o: $MODS_USED_MOD >> dependency.mk + fi; +done diff --git a/ED/src/include/dirent_win.h b/ED/src/include/dirent_win.h new file mode 100644 index 000000000..56ab58fd4 --- /dev/null +++ b/ED/src/include/dirent_win.h @@ -0,0 +1,1239 @@ +/* + * Dirent interface for Microsoft Visual Studio + * + * Copyright (C) 1998-2019 Toni Ronkko + * This file is part of dirent. Dirent may be freely distributed + * under the MIT license. For all details and documentation, see + * https://github.com/tronkko/dirent + */ +#ifndef DIRENT_H +#define DIRENT_H + +/* Hide warnings about unreferenced local functions */ +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wunused-function" +#elif defined(_MSC_VER) +# pragma warning(disable:4505) +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wunused-function" +#endif + +/* + * Include windows.h without Windows Sockets 1.1 to prevent conflicts with + * Windows Sockets 2.0. + */ +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Indicates that d_type field is available in dirent structure */ +#define _DIRENT_HAVE_D_TYPE + +/* Indicates that d_namlen field is available in dirent structure */ +#define _DIRENT_HAVE_D_NAMLEN + +/* Entries missing from MSVC 6.0 */ +#if !defined(FILE_ATTRIBUTE_DEVICE) +# define FILE_ATTRIBUTE_DEVICE 0x40 +#endif + +/* File type and permission flags for stat(), general mask */ +#if !defined(S_IFMT) +# define S_IFMT _S_IFMT +#endif + +/* Directory bit */ +#if !defined(S_IFDIR) +# define S_IFDIR _S_IFDIR +#endif + +/* Character device bit */ +#if !defined(S_IFCHR) +# define S_IFCHR _S_IFCHR +#endif + +/* Pipe bit */ +#if !defined(S_IFFIFO) +# define S_IFFIFO _S_IFFIFO +#endif + +/* Regular file bit */ +#if !defined(S_IFREG) +# define S_IFREG _S_IFREG +#endif + +/* Read permission */ +#if !defined(S_IREAD) +# define S_IREAD _S_IREAD +#endif + +/* Write permission */ +#if !defined(S_IWRITE) +# define S_IWRITE _S_IWRITE +#endif + +/* Execute permission */ +#if !defined(S_IEXEC) +# define S_IEXEC _S_IEXEC +#endif + +/* Pipe */ +#if !defined(S_IFIFO) +# define S_IFIFO _S_IFIFO +#endif + +/* Block device */ +#if !defined(S_IFBLK) +# define S_IFBLK 0 +#endif + +/* + * Symbolic link. Be ware that S_IFLNK value and S_ISLNK() macro are only + * usable with dirent - they do not work with stat() function call! + */ +#if !defined(S_IFLNK) +# define S_IFLNK (_S_IFDIR | _S_IFREG) +#endif + +/* Socket */ +#if !defined(S_IFSOCK) +# define S_IFSOCK 0 +#endif + +/* Read user permission */ +#if !defined(S_IRUSR) +# define S_IRUSR S_IREAD +#endif + +/* Write user permission */ +#if !defined(S_IWUSR) +# define S_IWUSR S_IWRITE +#endif + +/* Execute user permission */ +#if !defined(S_IXUSR) +# define S_IXUSR 0 +#endif + +/* User full permissions */ +#if !defined(S_IRWXU) +# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) +#endif + +/* Read group permission */ +#if !defined(S_IRGRP) +# define S_IRGRP 0 +#endif + +/* Write group permission */ +#if !defined(S_IWGRP) +# define S_IWGRP 0 +#endif + +/* Execute group permission */ +#if !defined(S_IXGRP) +# define S_IXGRP 0 +#endif + +/* Group full permissions */ +#if !defined(S_IRWXG) +# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) +#endif + +/* Read others permission */ +#if !defined(S_IROTH) +# define S_IROTH 0 +#endif + +/* Write others permission */ +#if !defined(S_IWOTH) +# define S_IWOTH 0 +#endif + +/* Execute others permission */ +#if !defined(S_IXOTH) +# define S_IXOTH 0 +#endif + +/* Other full permissions */ +#if !defined(S_IRWXO) +# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) +#endif + +/* Maximum length of file name */ +#if !defined(PATH_MAX) +# define PATH_MAX MAX_PATH +#endif +#if !defined(FILENAME_MAX) +# define FILENAME_MAX MAX_PATH +#endif +#if !defined(NAME_MAX) +# define NAME_MAX FILENAME_MAX +#endif + +/* File type flags for d_type */ +#define DT_UNKNOWN 0 +#define DT_REG S_IFREG +#define DT_DIR S_IFDIR +#define DT_FIFO S_IFIFO +#define DT_SOCK S_IFSOCK +#define DT_CHR S_IFCHR +#define DT_BLK S_IFBLK +#define DT_LNK S_IFLNK + +/* Macros for converting between st_mode and d_type */ +#define IFTODT(mode) ((mode) & S_IFMT) +#define DTTOIF(type) (type) + +/* + * File type macros. Note that block devices and sockets cannot be + * distinguished on Windows, and the macros S_ISBLK and S_ISSOCK are only + * defined for compatibility. These macros should always return false on + * Windows. + */ +#if !defined(S_ISFIFO) +# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) +#endif +#if !defined(S_ISDIR) +# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif +#if !defined(S_ISREG) +# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#endif +#if !defined(S_ISLNK) +# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) +#endif +#if !defined(S_ISSOCK) +# define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) +#endif +#if !defined(S_ISCHR) +# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) +#endif +#if !defined(S_ISBLK) +# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) +#endif + +/* Return the exact length of the file name without zero terminator */ +#define _D_EXACT_NAMLEN(p) ((p)->d_namlen) + +/* Return the maximum size of a file name */ +#define _D_ALLOC_NAMLEN(p) ((PATH_MAX)+1) + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Wide-character version */ +struct _wdirent { + /* Always zero */ + long d_ino; + + /* Position of next file in a directory stream */ + long d_off; + + /* Structure size */ + unsigned short d_reclen; + + /* Length of name without \0 */ + size_t d_namlen; + + /* File type */ + int d_type; + + /* File name */ + wchar_t d_name[PATH_MAX+1]; +}; +typedef struct _wdirent _wdirent; + +struct _WDIR { + /* Current directory entry */ + struct _wdirent ent; + + /* Private file data */ + WIN32_FIND_DATAW data; + + /* True if data is valid */ + int cached; + + /* True if next entry is invalid */ + int invalid; + + /* Win32 search handle */ + HANDLE handle; + + /* Initial directory name */ + wchar_t *patt; +}; +typedef struct _WDIR _WDIR; + +/* Multi-byte character version */ +struct dirent { + /* Always zero */ + long d_ino; + + /* Position of next file in a directory stream */ + long d_off; + + /* Structure size */ + unsigned short d_reclen; + + /* Length of name without \0 */ + size_t d_namlen; + + /* File type */ + int d_type; + + /* File name */ + char d_name[PATH_MAX+1]; +}; +typedef struct dirent dirent; + +struct DIR { + struct dirent ent; + struct _WDIR *wdirp; +}; +typedef struct DIR DIR; + + +/* Dirent functions */ +static DIR *opendir(const char *dirname); +static _WDIR *_wopendir(const wchar_t *dirname); + +static struct dirent *readdir(DIR *dirp); +static struct _wdirent *_wreaddir(_WDIR *dirp); + +static int readdir_r( + DIR *dirp, struct dirent *entry, struct dirent **result); +static int _wreaddir_r( + _WDIR *dirp, struct _wdirent *entry, struct _wdirent **result); + +static int closedir(DIR *dirp); +static int _wclosedir(_WDIR *dirp); + +static void rewinddir(DIR *dirp); +static void _wrewinddir(_WDIR *dirp); + +static long telldir(DIR *dirp); +static long _wtelldir(_WDIR *dirp); + +static void seekdir(DIR *dirp, long loc); +static void _wseekdir(_WDIR *dirp, long loc); + +static int scandir(const char *dirname, struct dirent ***namelist, + int (*filter)(const struct dirent*), + int (*compare)(const struct dirent**, const struct dirent**)); + +static int alphasort(const struct dirent **a, const struct dirent **b); + +static int versionsort(const struct dirent **a, const struct dirent **b); + +static int strverscmp(const char *a, const char *b); + +/* For compatibility with Symbian */ +#define wdirent _wdirent +#define WDIR _WDIR +#define wopendir _wopendir +#define wreaddir _wreaddir +#define wclosedir _wclosedir +#define wrewinddir _wrewinddir +#define wtelldir _wtelldir +#define wseekdir _wseekdir + +/* Compatibility with older Microsoft compilers and non-Microsoft compilers */ +#if !defined(_MSC_VER) || _MSC_VER < 1400 +# define wcstombs_s dirent_wcstombs_s +# define mbstowcs_s dirent_mbstowcs_s +#endif + +/* Optimize dirent_set_errno() away on modern Microsoft compilers */ +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# define dirent_set_errno _set_errno +#endif + + +/* Internal utility functions */ +static WIN32_FIND_DATAW *dirent_first(_WDIR *dirp); +static WIN32_FIND_DATAW *dirent_next(_WDIR *dirp); +static long dirent_hash(WIN32_FIND_DATAW *datap); + +#if !defined(_MSC_VER) || _MSC_VER < 1400 +static int dirent_mbstowcs_s( + size_t *pReturnValue, wchar_t *wcstr, size_t sizeInWords, + const char *mbstr, size_t count); +#endif + +#if !defined(_MSC_VER) || _MSC_VER < 1400 +static int dirent_wcstombs_s( + size_t *pReturnValue, char *mbstr, size_t sizeInBytes, + const wchar_t *wcstr, size_t count); +#endif + +#if !defined(_MSC_VER) || _MSC_VER < 1400 +static void dirent_set_errno(int error); +#endif + + +/* + * Open directory stream DIRNAME for read and return a pointer to the + * internal working area that is used to retrieve individual directory + * entries. + */ +static _WDIR * +_wopendir(const wchar_t *dirname) +{ + wchar_t *p; + + /* Must have directory name */ + if (dirname == NULL || dirname[0] == '\0') { + dirent_set_errno(ENOENT); + return NULL; + } + + /* Allocate new _WDIR structure */ + _WDIR *dirp = (_WDIR*) malloc(sizeof(struct _WDIR)); + if (!dirp) + return NULL; + + /* Reset _WDIR structure */ + dirp->handle = INVALID_HANDLE_VALUE; + dirp->patt = NULL; + dirp->cached = 0; + dirp->invalid = 0; + + /* + * Compute the length of full path plus zero terminator + * + * Note that on WinRT there's no way to convert relative paths + * into absolute paths, so just assume it is an absolute path. + */ +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + /* Desktop */ + DWORD n = GetFullPathNameW(dirname, 0, NULL, NULL); +#else + /* WinRT */ + size_t n = wcslen(dirname); +#endif + + /* Allocate room for absolute directory name and search pattern */ + dirp->patt = (wchar_t*) malloc(sizeof(wchar_t) * n + 16); + if (dirp->patt == NULL) + goto exit_closedir; + + /* + * Convert relative directory name to an absolute one. This + * allows rewinddir() to function correctly even when current + * working directory is changed between opendir() and rewinddir(). + * + * Note that on WinRT there's no way to convert relative paths + * into absolute paths, so just assume it is an absolute path. + */ +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + /* Desktop */ + n = GetFullPathNameW(dirname, n, dirp->patt, NULL); + if (n <= 0) + goto exit_closedir; +#else + /* WinRT */ + wcsncpy_s(dirp->patt, n+1, dirname, n); +#endif + + /* Append search pattern \* to the directory name */ + p = dirp->patt + n; + switch (p[-1]) { + case '\\': + case '/': + case ':': + /* Directory ends in path separator, e.g. c:\temp\ */ + /*NOP*/; + break; + + default: + /* Directory name doesn't end in path separator */ + *p++ = '\\'; + } + *p++ = '*'; + *p = '\0'; + + /* Open directory stream and retrieve the first entry */ + if (!dirent_first(dirp)) + goto exit_closedir; + + /* Success */ + return dirp; + + /* Failure */ +exit_closedir: + _wclosedir(dirp); + return NULL; +} + +/* + * Read next directory entry. + * + * Returns pointer to static directory entry which may be overwritten by + * subsequent calls to _wreaddir(). + */ +static struct _wdirent * +_wreaddir(_WDIR *dirp) +{ + /* + * Read directory entry to buffer. We can safely ignore the return + * value as entry will be set to NULL in case of error. + */ + struct _wdirent *entry; + (void) _wreaddir_r(dirp, &dirp->ent, &entry); + + /* Return pointer to statically allocated directory entry */ + return entry; +} + +/* + * Read next directory entry. + * + * Returns zero on success. If end of directory stream is reached, then sets + * result to NULL and returns zero. + */ +static int +_wreaddir_r( + _WDIR *dirp, struct _wdirent *entry, struct _wdirent **result) +{ + /* Validate directory handle */ + if (!dirp || dirp->handle == INVALID_HANDLE_VALUE || !dirp->patt) { + dirent_set_errno(EBADF); + *result = NULL; + return -1; + } + + /* Read next directory entry */ + WIN32_FIND_DATAW *datap = dirent_next(dirp); + if (!datap) { + /* Return NULL to indicate end of directory */ + *result = NULL; + return /*OK*/0; + } + + /* + * Copy file name as wide-character string. If the file name is too + * long to fit in to the destination buffer, then truncate file name + * to PATH_MAX characters and zero-terminate the buffer. + */ + size_t i = 0; + while (i < PATH_MAX && datap->cFileName[i] != 0) { + entry->d_name[i] = datap->cFileName[i]; + i++; + } + entry->d_name[i] = 0; + + /* Length of file name excluding zero terminator */ + entry->d_namlen = i; + + /* Determine file type */ + DWORD attr = datap->dwFileAttributes; + if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) + entry->d_type = DT_CHR; + else if ((attr & FILE_ATTRIBUTE_REPARSE_POINT) != 0) + entry->d_type = DT_LNK; + else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) + entry->d_type = DT_DIR; + else + entry->d_type = DT_REG; + + /* Read the next directory entry to cache */ + datap = dirent_next(dirp); + if (datap) { + /* Compute 31-bit hash of the next directory entry */ + entry->d_off = dirent_hash(datap); + + /* Push the next directory entry back to cache */ + dirp->cached = 1; + } else { + /* End of directory stream */ + entry->d_off = (long) ((~0UL) >> 1); + } + + /* Reset other fields */ + entry->d_ino = 0; + entry->d_reclen = sizeof(struct _wdirent); + + /* Set result address */ + *result = entry; + return /*OK*/0; +} + +/* + * Close directory stream opened by opendir() function. This invalidates the + * DIR structure as well as any directory entry read previously by + * _wreaddir(). + */ +static int +_wclosedir(_WDIR *dirp) +{ + if (!dirp) { + dirent_set_errno(EBADF); + return /*failure*/-1; + } + + /* + * Release search handle if we have one. Being able to handle + * partially initialized _WDIR structure allows us to use this + * function to handle errors occuring within _wopendir. + */ + if (dirp->handle != INVALID_HANDLE_VALUE) { + FindClose(dirp->handle); + } + + /* + * Release search pattern. Note that we don't need to care if + * dirp->patt is NULL or not: function free is guaranteed to act + * appropriately. + */ + free(dirp->patt); + + /* Release directory structure */ + free(dirp); + return /*success*/0; +} + +/* + * Rewind directory stream such that _wreaddir() returns the very first + * file name again. + */ +static void _wrewinddir(_WDIR* dirp) +{ + /* Check directory pointer */ + if (!dirp || dirp->handle == INVALID_HANDLE_VALUE || !dirp->patt) + return; + + /* Release existing search handle */ + FindClose(dirp->handle); + + /* Open new search handle */ + dirent_first(dirp); +} + +/* Get first directory entry */ +static WIN32_FIND_DATAW * +dirent_first(_WDIR *dirp) +{ + /* Open directory and retrieve the first entry */ + dirp->handle = FindFirstFileExW( + dirp->patt, FindExInfoStandard, &dirp->data, + FindExSearchNameMatch, NULL, 0); + if (dirp->handle == INVALID_HANDLE_VALUE) + goto error; + + /* A directory entry is now waiting in memory */ + dirp->cached = 1; + return &dirp->data; + +error: + /* Failed to open directory: no directory entry in memory */ + dirp->cached = 0; + dirp->invalid = 1; + + /* Set error code */ + DWORD errorcode = GetLastError(); + switch (errorcode) { + case ERROR_ACCESS_DENIED: + /* No read access to directory */ + dirent_set_errno(EACCES); + break; + + case ERROR_DIRECTORY: + /* Directory name is invalid */ + dirent_set_errno(ENOTDIR); + break; + + case ERROR_PATH_NOT_FOUND: + default: + /* Cannot find the file */ + dirent_set_errno(ENOENT); + } + return NULL; +} + +/* Get next directory entry */ +static WIN32_FIND_DATAW * +dirent_next(_WDIR *dirp) +{ + /* Return NULL if seek position was invalid */ + if (dirp->invalid) + return NULL; + + /* Is the next directory entry already in cache? */ + if (dirp->cached) { + /* Yes, a valid directory entry found in memory */ + dirp->cached = 0; + return &dirp->data; + } + + /* Read the next directory entry from stream */ + if (FindNextFileW(dirp->handle, &dirp->data) == FALSE) { + /* End of directory stream */ + return NULL; + } + + /* Success */ + return &dirp->data; +} + +/* + * Compute 31-bit hash of file name. + * + * See djb2 at http://www.cse.yorku.ca/~oz/hash.html + */ +static long +dirent_hash(WIN32_FIND_DATAW *datap) +{ + unsigned long hash = 5381; + unsigned long c; + const wchar_t *p = datap->cFileName; + const wchar_t *e = p + MAX_PATH; + while (p != e && (c = *p++) != 0) { + hash = (hash << 5) + hash + c; + } + + return (long) (hash & ((~0UL) >> 1)); +} + +/* Open directory stream using plain old C-string */ +static DIR *opendir(const char *dirname) +{ + /* Must have directory name */ + if (dirname == NULL || dirname[0] == '\0') { + dirent_set_errno(ENOENT); + return NULL; + } + + /* Allocate memory for DIR structure */ + struct DIR *dirp = (DIR*) malloc(sizeof(struct DIR)); + if (!dirp) + return NULL; + + /* Convert directory name to wide-character string */ + wchar_t wname[PATH_MAX + 1]; + size_t n; + int error = mbstowcs_s(&n, wname, PATH_MAX + 1, dirname, PATH_MAX+1); + if (error) + goto exit_failure; + + /* Open directory stream using wide-character name */ + dirp->wdirp = _wopendir(wname); + if (!dirp->wdirp) + goto exit_failure; + + /* Success */ + return dirp; + + /* Failure */ +exit_failure: + free(dirp); + return NULL; +} + +/* Read next directory entry */ +static struct dirent * +readdir(DIR *dirp) +{ + /* + * Read directory entry to buffer. We can safely ignore the return + * value as entry will be set to NULL in case of error. + */ + struct dirent *entry; + (void) readdir_r(dirp, &dirp->ent, &entry); + + /* Return pointer to statically allocated directory entry */ + return entry; +} + +/* + * Read next directory entry into called-allocated buffer. + * + * Returns zero on success. If the end of directory stream is reached, then + * sets result to NULL and returns zero. + */ +static int +readdir_r( + DIR *dirp, struct dirent *entry, struct dirent **result) +{ + /* Read next directory entry */ + WIN32_FIND_DATAW *datap = dirent_next(dirp->wdirp); + if (!datap) { + /* No more directory entries */ + *result = NULL; + return /*OK*/0; + } + + /* Attempt to convert file name to multi-byte string */ + size_t n; + int error = wcstombs_s( + &n, entry->d_name, PATH_MAX + 1, + datap->cFileName, PATH_MAX + 1); + + /* + * If the file name cannot be represented by a multi-byte string, then + * attempt to use old 8+3 file name. This allows the program to + * access files although file names may seem unfamiliar to the user. + * + * Be ware that the code below cannot come up with a short file name + * unless the file system provides one. At least VirtualBox shared + * folders fail to do this. + */ + if (error && datap->cAlternateFileName[0] != '\0') { + error = wcstombs_s( + &n, entry->d_name, PATH_MAX + 1, + datap->cAlternateFileName, PATH_MAX + 1); + } + + if (!error) { + /* Length of file name excluding zero terminator */ + entry->d_namlen = n - 1; + + /* Determine file type */ + DWORD attr = datap->dwFileAttributes; + if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) + entry->d_type = DT_CHR; + else if ((attr & FILE_ATTRIBUTE_REPARSE_POINT) != 0) + entry->d_type = DT_LNK; + else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) + entry->d_type = DT_DIR; + else + entry->d_type = DT_REG; + + /* Get offset of next file */ + datap = dirent_next(dirp->wdirp); + if (datap) { + /* Compute 31-bit hash of the next directory entry */ + entry->d_off = dirent_hash(datap); + + /* Push the next directory entry back to cache */ + dirp->wdirp->cached = 1; + } else { + /* End of directory stream */ + entry->d_off = (long) ((~0UL) >> 1); + } + + /* Reset fields */ + entry->d_ino = 0; + entry->d_reclen = sizeof(struct dirent); + } else { + /* + * Cannot convert file name to multi-byte string so construct + * an erroneous directory entry and return that. Note that + * we cannot return NULL as that would stop the processing + * of directory entries completely. + */ + entry->d_name[0] = '?'; + entry->d_name[1] = '\0'; + entry->d_namlen = 1; + entry->d_type = DT_UNKNOWN; + entry->d_ino = 0; + entry->d_off = -1; + entry->d_reclen = 0; + } + + /* Return pointer to directory entry */ + *result = entry; + return /*OK*/0; +} + +/* Close directory stream */ +static int +closedir(DIR *dirp) +{ + int ok; + + if (!dirp) + goto exit_failure; + + /* Close wide-character directory stream */ + ok = _wclosedir(dirp->wdirp); + dirp->wdirp = NULL; + + /* Release multi-byte character version */ + free(dirp); + return ok; + +exit_failure: + /* Invalid directory stream */ + dirent_set_errno(EBADF); + return /*failure*/-1; +} + +/* Rewind directory stream to beginning */ +static void +rewinddir(DIR *dirp) +{ + if (!dirp) + return; + + /* Rewind wide-character string directory stream */ + _wrewinddir(dirp->wdirp); +} + +/* Get position of directory stream */ +static long +_wtelldir(_WDIR *dirp) +{ + if (!dirp || dirp->handle == INVALID_HANDLE_VALUE) { + dirent_set_errno(EBADF); + return /*failure*/-1; + } + + /* Read next file entry */ + WIN32_FIND_DATAW *datap = dirent_next(dirp); + if (!datap) { + /* End of directory stream */ + return (long) ((~0UL) >> 1); + } + + /* Store file entry to cache for readdir() */ + dirp->cached = 1; + + /* Return the 31-bit hash code to be used as stream position */ + return dirent_hash(datap); +} + +/* Get position of directory stream */ +static long +telldir(DIR *dirp) +{ + if (!dirp) { + dirent_set_errno(EBADF); + return -1; + } + + return _wtelldir(dirp->wdirp); +} + +/* Seek directory stream to offset */ +static void +_wseekdir(_WDIR *dirp, long loc) +{ + if (!dirp) + return; + + /* Directory must be open */ + if (dirp->handle == INVALID_HANDLE_VALUE) + goto exit_failure; + + /* Ensure that seek position is valid */ + if (loc < 0) + goto exit_failure; + + /* Restart directory stream from the beginning */ + FindClose(dirp->handle); + if (!dirent_first(dirp)) + goto exit_failure; + + /* Reset invalid flag so that we can read from the stream again */ + dirp->invalid = 0; + + /* + * Read directory entries from the beginning until the hash matches a + * file name. Be ware that hash code is only 31 bits longs and + * duplicates are possible: the hash code cannot return the position + * with 100.00% accuracy! Moreover, the method is slow for large + * directories. + */ + long hash; + do { + /* Read next directory entry */ + WIN32_FIND_DATAW *datap = dirent_next(dirp); + if (!datap) { + /* + * End of directory stream was reached before finding + * the requested location. Perhaps the file in + * question was deleted or moved out of the directory. + */ + goto exit_failure; + } + + /* Does the file name match the hash? */ + hash = dirent_hash(datap); + } while (hash != loc); + + /* + * File name matches the hash! Push the directory entry back to cache + * from where next readdir() will return it. + */ + dirp->cached = 1; + dirp->invalid = 0; + return; + +exit_failure: + /* Ensure that readdir will return NULL */ + dirp->invalid = 1; +} + +/* Seek directory stream to offset */ +static void +seekdir(DIR *dirp, long loc) +{ + if (!dirp) + return; + + _wseekdir(dirp->wdirp, loc); +} + +/* Scan directory for entries */ +static int +scandir( + const char *dirname, struct dirent ***namelist, + int (*filter)(const struct dirent*), + int (*compare)(const struct dirent**, const struct dirent**)) +{ + int result; + + /* Open directory stream */ + DIR *dir = opendir(dirname); + if (!dir) { + /* Cannot open directory */ + return /*Error*/ -1; + } + + /* Read directory entries to memory */ + struct dirent *tmp = NULL; + struct dirent **files = NULL; + size_t size = 0; + size_t allocated = 0; + while (1) { + /* Allocate room for a temporary directory entry */ + if (!tmp) { + tmp = (struct dirent*) malloc(sizeof(struct dirent)); + if (!tmp) + goto exit_failure; + } + + /* Read directory entry to temporary area */ + struct dirent *entry; + if (readdir_r(dir, tmp, &entry) != /*OK*/0) + goto exit_failure; + + /* Stop if we already read the last directory entry */ + if (entry == NULL) + goto exit_success; + + /* Determine whether to include the entry in results */ + if (filter && !filter(tmp)) + continue; + + /* Enlarge pointer table to make room for another pointer */ + if (size >= allocated) { + /* Compute number of entries in the new table */ + size_t num_entries = size * 2 + 16; + + /* Allocate new pointer table or enlarge existing */ + void *p = realloc(files, sizeof(void*) * num_entries); + if (!p) + goto exit_failure; + + /* Got the memory */ + files = (dirent**) p; + allocated = num_entries; + } + + /* Store the temporary entry to ptr table */ + files[size++] = tmp; + tmp = NULL; + } + +exit_failure: + /* Release allocated entries */ + for (size_t i = 0; i < size; i++) { + free(files[i]); + } + + /* Release the pointer table */ + free(files); + files = NULL; + + /* Exit with error code */ + result = /*error*/ -1; + goto exit_status; + +exit_success: + /* Sort directory entries */ + if (size > 1 && compare) { + qsort(files, size, sizeof(void*), + (int (*) (const void*, const void*)) compare); + } + + /* Pass pointer table to caller */ + if (namelist) + *namelist = files; + + /* Return the number of directory entries read */ + result = (int) size; + +exit_status: + /* Release temporary directory entry, if we had one */ + free(tmp); + + /* Close directory stream */ + closedir(dir); + return result; +} + +/* Alphabetical sorting */ +static int +alphasort(const struct dirent **a, const struct dirent **b) +{ + return strcoll((*a)->d_name, (*b)->d_name); +} + +/* Sort versions */ +static int +versionsort(const struct dirent **a, const struct dirent **b) +{ + return strverscmp((*a)->d_name, (*b)->d_name); +} + +/* Compare strings */ +static int +strverscmp(const char *a, const char *b) +{ + size_t i = 0; + size_t j; + + /* Find first difference */ + while (a[i] == b[i]) { + if (a[i] == '\0') { + /* No difference */ + return 0; + } + ++i; + } + + /* Count backwards and find the leftmost digit */ + j = i; + while (j > 0 && isdigit(a[j-1])) { + --j; + } + + /* Determine mode of comparison */ + if (a[j] == '0' || b[j] == '0') { + /* Find the next non-zero digit */ + while (a[j] == '0' && a[j] == b[j]) { + j++; + } + + /* String with more digits is smaller, e.g 002 < 01 */ + if (isdigit(a[j])) { + if (!isdigit(b[j])) { + return -1; + } + } else if (isdigit(b[j])) { + return 1; + } + } else if (isdigit(a[j]) && isdigit(b[j])) { + /* Numeric comparison */ + size_t k1 = j; + size_t k2 = j; + + /* Compute number of digits in each string */ + while (isdigit(a[k1])) { + k1++; + } + while (isdigit(b[k2])) { + k2++; + } + + /* Number with more digits is bigger, e.g 999 < 1000 */ + if (k1 < k2) + return -1; + else if (k1 > k2) + return 1; + } + + /* Alphabetical comparison */ + return (int) ((unsigned char) a[i]) - ((unsigned char) b[i]); +} + +/* Convert multi-byte string to wide character string */ +#if !defined(_MSC_VER) || _MSC_VER < 1400 +static int +dirent_mbstowcs_s( + size_t *pReturnValue, wchar_t *wcstr, + size_t sizeInWords, const char *mbstr, size_t count) +{ + /* Older Visual Studio or non-Microsoft compiler */ + size_t n = mbstowcs(wcstr, mbstr, sizeInWords); + if (wcstr && n >= count) + return /*error*/ 1; + + /* Zero-terminate output buffer */ + if (wcstr && sizeInWords) { + if (n >= sizeInWords) + n = sizeInWords - 1; + wcstr[n] = 0; + } + + /* Length of multi-byte string with zero terminator */ + if (pReturnValue) { + *pReturnValue = n + 1; + } + + /* Success */ + return 0; +} +#endif + +/* Convert wide-character string to multi-byte string */ +#if !defined(_MSC_VER) || _MSC_VER < 1400 +static int +dirent_wcstombs_s( + size_t *pReturnValue, char *mbstr, + size_t sizeInBytes, const wchar_t *wcstr, size_t count) +{ + /* Older Visual Studio or non-Microsoft compiler */ + size_t n = wcstombs(mbstr, wcstr, sizeInBytes); + if (mbstr && n >= count) + return /*error*/1; + + /* Zero-terminate output buffer */ + if (mbstr && sizeInBytes) { + if (n >= sizeInBytes) { + n = sizeInBytes - 1; + } + mbstr[n] = '\0'; + } + + /* Length of resulting multi-bytes string WITH zero-terminator */ + if (pReturnValue) { + *pReturnValue = n + 1; + } + + /* Success */ + return 0; +} +#endif + +/* Set errno variable */ +#if !defined(_MSC_VER) || _MSC_VER < 1400 +static void +dirent_set_errno(int error) +{ + /* Non-Microsoft compiler or older Microsoft compiler */ + errno = error; +} +#endif + +#ifdef __cplusplus +} +#endif +#endif /*DIRENT_H*/ \ No newline at end of file diff --git a/ED/src/utils/utils_c.c b/ED/src/utils/utils_c.c index ac26b5727..7bc79f1f3 100644 --- a/ED/src/utils/utils_c.c +++ b/ED/src/utils/utils_c.c @@ -314,7 +314,11 @@ int vfscale(float *a,int n,double *min,double *max ) } /************************************************************************/ +#ifdef _WIN32 +#include +#else #include +#endif #include void filelist_c_( int *inum, int *indices, char *prefix, char *chario){ @@ -535,7 +539,7 @@ void filelist_c_( int *inum, int *indices, char *prefix, char *chario){ /* This is for the omp thread/processor pinning check. */ /* MLO. This didn't work in the SUNHPC cluster, disabling it for now */ -#if defined(SUNHPC) || defined(__APPLE__) +#if defined(SUNHPC) || defined(__APPLE__) || defined(_WIN32) int findmycpu_ () { int cpu; diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 000000000..1aa1a8e81 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,32 @@ +# Include the objects.mk file first to define $(SRC_MAIN) and $(OBJ_MODEL) +include ED/build/shell/sources.mk + +SRC_MAIN = ED/src/driver/edmain.F90 + +AUTOMAKE_OPTIONS = subdir-objects + +# Define the main program and static library variables +MAIN = ed2 +STATICLIB = libed2.a + +# Define the programs and libraries +bin_PROGRAMS = $(MAIN) +lib_LIBRARIES = $(STATICLIB) + +# Compiler and linker flags +AM_CFLAGS = @CFLAGS@ +AM_FCFLAGS = @CFLAGS@ +AM_LDFLAGS = @LIBS@ + +# Define source files for the main program +ed2_SOURCES = $(SRC_MAIN) +ed2_LDADD = $(STATICLIB) + +# Define source files for the static library +libed2_a_SOURCES = $(SOURCES) + +# Additional Fortran clean files +CLEANFILES = *.mod + +# Include the dependency makefile +include ED/build/shell/dependency.mk From 851d1a7a8aad033b3d84988053e93fed1d2246d4 Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Wed, 26 Jun 2024 15:42:47 -0400 Subject: [PATCH 02/11] Add necessary files for automake to work (should be filled afterwards) --- .gitignore | 31 +++++ AUTHORS | 0 COPYING | 0 ChangeLog | 0 INSTALL | 368 +++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 0 6 files changed, 399 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 NEWS diff --git a/.gitignore b/.gitignore index 72c31d845..393393b34 100644 --- a/.gitignore +++ b/.gitignore @@ -166,3 +166,34 @@ R-utils/read.q.quick.r #Xiangtao Ignores ED/build/ed2_gfortran ED/build/ed2_ifort + + +# http://www.gnu.org/software/automake +Makefile.in +/ar-lib +/mdate-sh +/py-compile +/test-driver +/ylwrap +.deps/ +.dirstamp + +# http://www.gnu.org/software/autoconf +autom4te.cache +/autoscan.log +/autoscan-*.log +/aclocal.m4 +/compile +/config.cache +/config.guess +/config.h.in +/config.log +/config.status +/config.sub +/configure +/configure.scan +/depcomp +/install-sh +/missing +/stamp-h1 +/Makefile diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 000000000..e69de29bb diff --git a/COPYING b/COPYING new file mode 100644 index 000000000..e69de29bb diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/INSTALL b/INSTALL new file mode 100644 index 000000000..e82fd21de --- /dev/null +++ b/INSTALL @@ -0,0 +1,368 @@ +Installation Instructions +************************* + + Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free +Software Foundation, Inc. + + Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without warranty of any kind. + +Basic Installation +================== + + Briefly, the shell command './configure && make && make install' +should configure, build, and install this package. The following +more-detailed instructions are generic; see the 'README' file for +instructions specific to this package. Some packages provide this +'INSTALL' file but do not implement all of the features documented +below. The lack of an optional feature in a given package is not +necessarily a bug. More recommendations for GNU packages can be found +in *note Makefile Conventions: (standards)Makefile Conventions. + + The 'configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a 'Makefile' in each directory of the package. +It may also create one or more '.h' files containing system-dependent +definitions. Finally, it creates a shell script 'config.status' that +you can run in the future to recreate the current configuration, and a +file 'config.log' containing compiler output (useful mainly for +debugging 'configure'). + + It can also use an optional file (typically called 'config.cache' and +enabled with '--cache-file=config.cache' or simply '-C') that saves the +results of its tests to speed up reconfiguring. Caching is disabled by +default to prevent problems with accidental use of stale cache files. + + If you need to do unusual things to compile the package, please try +to figure out how 'configure' could check whether to do them, and mail +diffs or instructions to the address given in the 'README' so they can +be considered for the next release. If you are using the cache, and at +some point 'config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file 'configure.ac' (or 'configure.in') is used to create +'configure' by a program called 'autoconf'. You need 'configure.ac' if +you want to change it or regenerate 'configure' using a newer version of +'autoconf'. + + The simplest way to compile this package is: + + 1. 'cd' to the directory containing the package's source code and type + './configure' to configure the package for your system. + + Running 'configure' might take a while. While running, it prints + some messages telling which features it is checking for. + + 2. Type 'make' to compile the package. + + 3. Optionally, type 'make check' to run any self-tests that come with + the package, generally using the just-built uninstalled binaries. + + 4. Type 'make install' to install the programs and any data files and + documentation. When installing into a prefix owned by root, it is + recommended that the package be configured and built as a regular + user, and only the 'make install' phase executed with root + privileges. + + 5. Optionally, type 'make installcheck' to repeat any self-tests, but + this time using the binaries in their final installed location. + This target does not install anything. Running this target as a + regular user, particularly if the prior 'make install' required + root privileges, verifies that the installation completed + correctly. + + 6. You can remove the program binaries and object files from the + source code directory by typing 'make clean'. To also remove the + files that 'configure' created (so you can compile the package for + a different kind of computer), type 'make distclean'. There is + also a 'make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + 7. Often, you can also type 'make uninstall' to remove the installed + files again. In practice, not all packages have tested that + uninstallation works correctly, even though it is required by the + GNU Coding Standards. + + 8. Some packages, particularly those that use Automake, provide 'make + distcheck', which can by used by developers to test that all other + targets like 'make install' and 'make uninstall' work correctly. + This target is generally not run by end users. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the 'configure' script does not know about. Run './configure --help' +for details on some of the pertinent environment variables. + + You can give 'configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here is +an example: + + ./configure CC=c99 CFLAGS=-g LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you can use GNU 'make'. 'cd' to the +directory where you want the object files and executables to go and run +the 'configure' script. 'configure' automatically checks for the source +code in the directory that 'configure' is in and in '..'. This is known +as a "VPATH" build. + + With a non-GNU 'make', it is safer to compile the package for one +architecture at a time in the source code directory. After you have +installed the package for one architecture, use 'make distclean' before +reconfiguring for another architecture. + + On MacOS X 10.5 and later systems, you can create libraries and +executables that work on multiple system types--known as "fat" or +"universal" binaries--by specifying multiple '-arch' options to the +compiler but only a single '-arch' option to the preprocessor. Like +this: + + ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ + CPP="gcc -E" CXXCPP="g++ -E" + + This is not guaranteed to produce working output in all cases, you +may have to build one architecture at a time and combine the results +using the 'lipo' tool if you have problems. + +Installation Names +================== + + By default, 'make install' installs the package's commands under +'/usr/local/bin', include files under '/usr/local/include', etc. You +can specify an installation prefix other than '/usr/local' by giving +'configure' the option '--prefix=PREFIX', where PREFIX must be an +absolute file name. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option '--exec-prefix=PREFIX' to 'configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like '--bindir=DIR' to specify different values for particular +kinds of files. Run 'configure --help' for a list of the directories +you can set and what kinds of files go in them. In general, the default +for these options is expressed in terms of '${prefix}', so that +specifying just '--prefix' will affect all of the other directory +specifications that were not explicitly provided. + + The most portable way to affect installation locations is to pass the +correct locations to 'configure'; however, many packages provide one or +both of the following shortcuts of passing variable assignments to the +'make install' command line to change installation locations without +having to reconfigure or recompile. + + The first method involves providing an override variable for each +affected directory. For example, 'make install +prefix=/alternate/directory' will choose an alternate location for all +directory configuration variables that were expressed in terms of +'${prefix}'. Any directories that were specified during 'configure', +but not in terms of '${prefix}', must each be overridden at install time +for the entire installation to be relocated. The approach of makefile +variable overrides for each directory variable is required by the GNU +Coding Standards, and ideally causes no recompilation. However, some +platforms have known limitations with the semantics of shared libraries +that end up requiring recompilation when using this method, particularly +noticeable in packages that use GNU Libtool. + + The second method involves providing the 'DESTDIR' variable. For +example, 'make install DESTDIR=/alternate/directory' will prepend +'/alternate/directory' before all installation names. The approach of +'DESTDIR' overrides is not required by the GNU Coding Standards, and +does not work on platforms that have drive letters. On the other hand, +it does better at avoiding recompilation issues, and works well even +when some directory options were not specified in terms of '${prefix}' +at 'configure' time. + +Optional Features +================= + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving 'configure' the +option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. + + Some packages pay attention to '--enable-FEATURE' options to +'configure', where FEATURE indicates an optional part of the package. +They may also pay attention to '--with-PACKAGE' options, where PACKAGE +is something like 'gnu-as' or 'x' (for the X Window System). The +'README' should mention any '--enable-' and '--with-' options that the +package recognizes. + + For packages that use the X Window System, 'configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the 'configure' options '--x-includes=DIR' and +'--x-libraries=DIR' to specify their locations. + + Some packages offer the ability to configure how verbose the +execution of 'make' will be. For these packages, running './configure +--enable-silent-rules' sets the default to minimal output, which can be +overridden with 'make V=1'; while running './configure +--disable-silent-rules' sets the default to verbose, which can be +overridden with 'make V=0'. + +Particular systems +================== + + On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC +is not installed, it is recommended to use the following options in +order to use an ANSI C compiler: + + ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" + +and if that doesn't work, install pre-built binaries of GCC for HP-UX. + + HP-UX 'make' updates targets which have the same timestamps as their +prerequisites, which makes it generally unusable when shipped generated +files such as 'configure' are involved. Use GNU 'make' instead. + + On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot +parse its '' header file. The option '-nodtk' can be used as a +workaround. If GNU CC is not installed, it is therefore recommended to +try + + ./configure CC="cc" + +and if that doesn't work, try + + ./configure CC="cc -nodtk" + + On Solaris, don't put '/usr/ucb' early in your 'PATH'. This +directory contains several dysfunctional programs; working variants of +these programs are available in '/usr/bin'. So, if you need '/usr/ucb' +in your 'PATH', put it _after_ '/usr/bin'. + + On Haiku, software installed for all users goes in '/boot/common', +not '/usr/local'. It is recommended to use the following options: + + ./configure --prefix=/boot/common + +Specifying the System Type +========================== + + There may be some features 'configure' cannot figure out +automatically, but needs to determine by the type of machine the package +will run on. Usually, assuming the package is built to be run on the +_same_ architectures, 'configure' can figure that out, but if it prints +a message saying it cannot guess the machine type, give it the +'--build=TYPE' option. TYPE can either be a short name for the system +type, such as 'sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file 'config.sub' for the possible values of each field. If +'config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option '--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with '--host=TYPE'. + +Sharing Defaults +================ + + If you want to set default values for 'configure' scripts to share, +you can create a site shell script called 'config.site' that gives +default values for variables like 'CC', 'cache_file', and 'prefix'. +'configure' looks for 'PREFIX/share/config.site' if it exists, then +'PREFIX/etc/config.site' if it exists. Or, you can set the +'CONFIG_SITE' environment variable to the location of the site script. +A warning: not all 'configure' scripts look for a site script. + +Defining Variables +================== + + Variables not defined in a site shell script can be set in the +environment passed to 'configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the 'configure' command line, using 'VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified 'gcc' to be used as the C compiler (unless it is +overridden in the site shell script). + +Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an +Autoconf limitation. Until the limitation is lifted, you can use this +workaround: + + CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash + +'configure' Invocation +====================== + + 'configure' recognizes the following options to control how it +operates. + +'--help' +'-h' + Print a summary of all of the options to 'configure', and exit. + +'--help=short' +'--help=recursive' + Print a summary of the options unique to this package's + 'configure', and exit. The 'short' variant lists options used only + in the top level, while the 'recursive' variant lists options also + present in any nested packages. + +'--version' +'-V' + Print the version of Autoconf used to generate the 'configure' + script, and exit. + +'--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally 'config.cache'. FILE defaults to '/dev/null' to + disable caching. + +'--config-cache' +'-C' + Alias for '--cache-file=config.cache'. + +'--quiet' +'--silent' +'-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to '/dev/null' (any error + messages will still be shown). + +'--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + 'configure' can determine that directory automatically. + +'--prefix=DIR' + Use DIR as the installation prefix. *note Installation Names:: for + more details, including other options available for fine-tuning the + installation locations. + +'--no-create' +'-n' + Run the configure checks, but stop before creating any output + files. + +'configure' also accepts some other, not widely useful, options. Run +'configure --help' for more details. diff --git a/NEWS b/NEWS new file mode 100644 index 000000000..e69de29bb From a108c800e5379332c95dd2138b4242ab4d06b658 Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Wed, 26 Jun 2024 15:59:25 -0400 Subject: [PATCH 03/11] Use autotools to automatically find the libraries and define the compilation rules --- configure.ac | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 configure.ac diff --git a/configure.ac b/configure.ac new file mode 100644 index 000000000..422406a1c --- /dev/null +++ b/configure.ac @@ -0,0 +1,79 @@ +AC_INIT([ED2],[m4_esyscmd_s([sed -n 's/.*ED_VERSION=\(.*\)/\1/p' ED/build/make/paths.mk])]) +AM_INIT_AUTOMAKE + +MAIN="ed-${PACKAGE_VERSION}" +os_name=$(uname | sed "s/-.*//") +SHLIB="rED2.so" + +CFLAGS="${CFLAGS} -I\"ED/src/include\"" + +PKG_PROG_PKG_CONFIG() +AS_IF([test "x$os_name" != "xDarwin" -a "x$os_name" != "xLinux"], + [ + AC_DEFINE_UNQUOTED([PKG_CONFIG_SYSTEM_INCLUDE_PATH], ["$PKG_CONFIG_SYSTEM_INCLUDE_PATH"], [MINGW defined pkg-config default system path]) + CFLAGS="${CFLAGS} -I\"${PKG_CONFIG_SYSTEM_INCLUDE_PATH}\" ${FFLAGS} -D_WIN32" + CPPFLAGS="${CFLAGS} ${FFLAGS} -D_WIN32" + MAIN="${MAIN}.exe" + SHLIB="rED2.dll" + ] +) + + +AC_PROG_FC([ifx ifort mpif90 gfortran]) +AC_PROG_CC +AC_PROG_RANLIB +AC_LANG([Fortran]) + + +PKG_CHECK_MODULES([HDF5], [hdf5_fortran], [have_hdf5=yes], [have_hdf5=no]) + +AS_IF([test "x$FC" = "xmpif90"], + [ + AS_IF([test "x$os_name" = "xMSYS_NT"], + [ + PKG_CHECK_MODULES([MPI], [msmpi], [have_mpi=yes], [have_mpi=no]) + ], + [ + PKG_CHECK_MODULES([MPI], [mpi-fort mpich], [have_mpi=yes], [have_mpi=no]) + ] + ) + + AS_IF([test "x$have_mpi" = "xyes"], + [ + CFLAGS="${CFLAGS} ${MPI_CFLAGS}" + LIBS="${LIBS} ${MPI_LIBS}" + ], + [ + AC_PROG_FC([gfortran]) + ] + ) + ] +) + + +AS_IF([test "x$have_hdf5" = "xyes"], + [ + LIBS="${LIBS} ${HDF5_LIBS} ${MPILIBS}" + CFLAGS="${CFLAGS} ${HDF5_CFLAGS}" + ], + [ + AC_MSG_ERROR([HDF5 library not found! + Please install HDF5 library and try again: + + Debian: sudo apt-get install libhdf5-dev + Fedora: sudo dnf install hdf5-devel + CentOS: sudo yum install hdf5-devel + MacOS: brew install hdf5 + Windows MinGW: pacman -S mingw-w64-x86_64-hdf5 + ]) + ] +) + +AC_SUBST([CC]) +AC_SUBST([FC]) +AC_SUBST([SHLIB]) +AC_SUBST([MAIN]) +AC_SUBST([LIBS]) +AC_SUBST([CFLAGS]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT \ No newline at end of file From 52aa1a6de9b279170a27965306cfdf2e4dc99456 Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Wed, 26 Jun 2024 16:23:05 -0400 Subject: [PATCH 04/11] First attempt to compile with MPI --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 422406a1c..6400a13f7 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ PKG_CHECK_MODULES([HDF5], [hdf5_fortran], [have_hdf5=yes], [have_hdf5=no]) AS_IF([test "x$FC" = "xmpif90"], [ - AS_IF([test "x$os_name" = "xMSYS_NT"], + AS_IF([test "x$os_name" != "xDarwin" -a "x$os_name" != "xLinux"], [ PKG_CHECK_MODULES([MPI], [msmpi], [have_mpi=yes], [have_mpi=no]) ], @@ -40,7 +40,7 @@ AS_IF([test "x$FC" = "xmpif90"], AS_IF([test "x$have_mpi" = "xyes"], [ - CFLAGS="${CFLAGS} ${MPI_CFLAGS}" + CFLAGS="${CFLAGS} ${MPI_CFLAGS} -DRAMS_MPI -fallow-invalid-boz -fallow-argument-mismatch" LIBS="${LIBS} ${MPI_LIBS}" ], [ From ee984bf46c25fefe101d8dfcbd5b1e9ba2889a06 Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Wed, 26 Jun 2024 16:48:33 -0400 Subject: [PATCH 05/11] Update configure.ac: try to link to hdf5_fortran even without hdf5_fortran.pc --- configure.ac | 58 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 6400a13f7..203c16033 100644 --- a/configure.ac +++ b/configure.ac @@ -11,8 +11,8 @@ PKG_PROG_PKG_CONFIG() AS_IF([test "x$os_name" != "xDarwin" -a "x$os_name" != "xLinux"], [ AC_DEFINE_UNQUOTED([PKG_CONFIG_SYSTEM_INCLUDE_PATH], ["$PKG_CONFIG_SYSTEM_INCLUDE_PATH"], [MINGW defined pkg-config default system path]) - CFLAGS="${CFLAGS} -I\"${PKG_CONFIG_SYSTEM_INCLUDE_PATH}\" ${FFLAGS} -D_WIN32" - CPPFLAGS="${CFLAGS} ${FFLAGS} -D_WIN32" + CFLAGS="${CFLAGS} -I\"${PKG_CONFIG_SYSTEM_INCLUDE_PATH}\" ${FCFLAGS} -D_WIN32" + CPPFLAGS="${CFLAGS} ${FCFLAGS} -D_WIN32" MAIN="${MAIN}.exe" SHLIB="rED2.dll" ] @@ -25,7 +25,7 @@ AC_PROG_RANLIB AC_LANG([Fortran]) -PKG_CHECK_MODULES([HDF5], [hdf5_fortran], [have_hdf5=yes], [have_hdf5=no]) +PKG_CHECK_MODULES([hdf5_fortran], [hdf5_fortran], [have_hdf5=yes], [have_hdf5=no]) AS_IF([test "x$FC" = "xmpif90"], [ @@ -34,7 +34,7 @@ AS_IF([test "x$FC" = "xmpif90"], PKG_CHECK_MODULES([MPI], [msmpi], [have_mpi=yes], [have_mpi=no]) ], [ - PKG_CHECK_MODULES([MPI], [mpi-fort mpich], [have_mpi=yes], [have_mpi=no]) + PKG_CHECK_MODULES([MPI], [mpi-fort], [have_mpi=yes], [have_mpi=no]) ] ) @@ -53,22 +53,52 @@ AS_IF([test "x$FC" = "xmpif90"], AS_IF([test "x$have_hdf5" = "xyes"], [ - LIBS="${LIBS} ${HDF5_LIBS} ${MPILIBS}" - CFLAGS="${CFLAGS} ${HDF5_CFLAGS}" + LIBS="${LIBS} ${hdf5_fortran_LIBS} ${MPILIBS}" + CFLAGS="${CFLAGS} ${hdf5_fortran_CFLAGS}" ], [ - AC_MSG_ERROR([HDF5 library not found! - Please install HDF5 library and try again: + PKG_CHECK_MODULES([HDF5], [hdf5], [have_hdf5=yes], [have_hdf5=no]) - Debian: sudo apt-get install libhdf5-dev - Fedora: sudo dnf install hdf5-devel - CentOS: sudo yum install hdf5-devel - MacOS: brew install hdf5 - Windows MinGW: pacman -S mingw-w64-x86_64-hdf5 - ]) + AS_IF([test "x$have_hdf5" = "xyes"], + [ + LIBS="${LIBS} ${HDF5_LIBS} -lhdf5 -lhdf5_fortran" + FCFLAGS="${CFLAGS} ${HDF5_CFLAGS}" + + AC_MSG_CHECKING([for HDF5 support in Fortran]) + AC_LANG_PUSH([Fortran]) + + AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[ + use hdf5 + integer :: hdferr + call h5open_f(hdferr) + call h5close_f(hdferr) + ]])], + [AC_MSG_RESULT([yes]) + HDF5_OK=yes], + [AC_MSG_RESULT([no]) + HDF5_OK=no]) + + AC_LANG_POP([Fortran]) + ], + [have_hdf5=no]) ] ) +AS_IF([test "x$have_hdf5" = "xno"],[ + AC_MSG_ERROR([ +HDF5 library not found! + +Please install HDF5 library and try again: + + Debian: sudo apt-get install libhdf5-dev + Fedora: sudo dnf install hdf5-devel + CentOS: sudo yum install hdf5-devel + MacOS: brew install hdf5 + Windows MinGW: pacman -S mingw-w64-x86_64-hdf5 + ]) +]) + + AC_SUBST([CC]) AC_SUBST([FC]) AC_SUBST([SHLIB]) From a6ac5ab6abe7ca08545ed6a52278b30d5e8be63d Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Thu, 27 Jun 2024 16:07:48 -0400 Subject: [PATCH 06/11] Change CI installation instructions --- .github/workflows/ci.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3381f063..98af3a864 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: build: @@ -11,13 +11,20 @@ jobs: run: sudo apt-get install -y --no-install-recommends gfortran libhdf5-openmpi-dev libopenmpi-dev - name: Install ED2 run: | - cd ED/build - ./install.sh -g -p travisci -k A + pushd ED/build/shell + bash build_objects.sh + popd + aclocal + automake --add-missing + autoconf + ./configure + make + sudo make install - name: Upload compiled ED2 binary uses: actions/upload-artifact@v1 with: name: ed2-binary - path: ED/build/ed_2.2-dbg + path: ed2 test-umbs-bg: needs: build @@ -33,8 +40,8 @@ jobs: - name: Run ED2 working-directory: ./EDTS/ run: | - chmod +x "$GITHUB_WORKSPACE"/ed2-binary/ed_2.2-dbg - ./run-test.sh umbs.bg "$GITHUB_WORKSPACE/ed2-binary/ed_2.2-dbg" + chmod +x "$GITHUB_WORKSPACE"/ed2-binary/ed2 + ./run-test.sh umbs.bg "$GITHUB_WORKSPACE/ed2-binary/ed2" test-tonzi: needs: build @@ -50,8 +57,8 @@ jobs: - name: Run ED2 working-directory: ./EDTS/ run: | - chmod +x "$GITHUB_WORKSPACE"/ed2-binary/ed_2.2-dbg - ./run-test.sh tonzi "$GITHUB_WORKSPACE/ed2-binary/ed_2.2-dbg" + chmod +x "$GITHUB_WORKSPACE"/ed2-binary/ed2 + ./run-test.sh tonzi "$GITHUB_WORKSPACE/ed2-binary/ed2" test-tonzi-harvest: needs: build @@ -67,5 +74,5 @@ jobs: - name: Run ED2 working-directory: ./EDTS/ run: | - chmod +x "$GITHUB_WORKSPACE"/ed2-binary/ed_2.2-dbg - ./run-test.sh tonzi.harvest "$GITHUB_WORKSPACE/ed2-binary/ed_2.2-dbg" + chmod +x "$GITHUB_WORKSPACE"/ed2-binary/ed2 + ./run-test.sh tonzi.harvest "$GITHUB_WORKSPACE/ed2-binary/ed2" From 063e63e300492df91e0d0c9b753aa1d32189d221 Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Fri, 28 Jun 2024 16:22:50 -0400 Subject: [PATCH 07/11] configure.ac: more robust configuration setting test to f90 --- configure.ac | 151 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 92 insertions(+), 59 deletions(-) diff --git a/configure.ac b/configure.ac index 203c16033..69df7b639 100644 --- a/configure.ac +++ b/configure.ac @@ -5,100 +5,133 @@ MAIN="ed-${PACKAGE_VERSION}" os_name=$(uname | sed "s/-.*//") SHLIB="rED2.so" -CFLAGS="${CFLAGS} -I\"ED/src/include\"" +CFLAGS="${CFLAGS} -IED/src/include" PKG_PROG_PKG_CONFIG() AS_IF([test "x$os_name" != "xDarwin" -a "x$os_name" != "xLinux"], [ AC_DEFINE_UNQUOTED([PKG_CONFIG_SYSTEM_INCLUDE_PATH], ["$PKG_CONFIG_SYSTEM_INCLUDE_PATH"], [MINGW defined pkg-config default system path]) - CFLAGS="${CFLAGS} -I\"${PKG_CONFIG_SYSTEM_INCLUDE_PATH}\" ${FCFLAGS} -D_WIN32" - CPPFLAGS="${CFLAGS} ${FCFLAGS} -D_WIN32" + AS_IF([test "x$PKG_CONFIG_SYSTEM_INCLUDE_PATH" != "x"], + [ + CFLAGS="${CFLAGS} -I\"${PKG_CONFIG_SYSTEM_INCLUDE_PATH}\" ${FCFLAGS} -D_WIN32" + ]) MAIN="${MAIN}.exe" SHLIB="rED2.dll" ] ) + AC_PROG_FC([ifx ifort mpif90 gfortran]) AC_PROG_CC AC_PROG_RANLIB AC_LANG([Fortran]) +# Check for hdf5_fortran +PKG_CHECK_MODULES([hdf5_fortran], [hdf5_fortran], [ + LIBS="${LIBS} ${hdf5_fortran_LIBS}" + CFLAGS="${CFLAGS} ${hdf5_fortran_CFLAGS}" + ], [ + # If hdf5_fortran is not found, check for hdf5 + PKG_CHECK_MODULES([hdf5], [hdf5], [ + # Add hdf5 flags + LIBS="${LIBS} ${hdf5_LIBS} -lhdf5_fortran" + CFLAGS="${CFLAGS} ${hdf5_CFLAGS}" + ], [ + # Try to link directly + LIBS="${LIBS} -lhdf5_fortran -lhdf5" + ]) +]) + +# Link check for HDF5 support in Fortran +FCFLAGS="${CFLAGS}" +FFLAGS="${CFLAGS}" +AC_FC_SRCEXT(f90) + +AC_MSG_CHECKING([if HDF5 library can link with Fortran code]) +AC_LINK_IFELSE([AC_LANG_PROGRAM(, [[ + use hdf5 + integer :: hdferr + call h5open_f(hdferr) + call h5close_f(hdferr) + ]])], [ + AC_MSG_RESULT([yes]) + have_hdf5=yes + ], [ + AC_MSG_RESULT([no]) + have_hdf5=no + ] +) + +# Case where HDF5 library is not found +AS_IF([test "x$have_hdf5" = "xno"],[ + AC_MSG_ERROR([ +HDF5 library not found! + +Please install HDF5 library and try again: -PKG_CHECK_MODULES([hdf5_fortran], [hdf5_fortran], [have_hdf5=yes], [have_hdf5=no]) + Debian: sudo apt-get install libhdf5-dev + Fedora: sudo dnf install hdf5-devel + CentOS: sudo yum install hdf5-devel + MacOS: brew install hdf5 + Windows MinGW: pacman -S mingw-w64-ucrt-x86_64-hdf5 + ]) +]) +# Check for MPI library if mpif90 was found AS_IF([test "x$FC" = "xmpif90"], [ + ORIGINAL_CFLAGS="${CFLAGS}" + ORIGINAL_LIBS="${LIBS}" + AS_IF([test "x$os_name" != "xDarwin" -a "x$os_name" != "xLinux"], [ - PKG_CHECK_MODULES([MPI], [msmpi], [have_mpi=yes], [have_mpi=no]) + PKG_CHECK_MODULES([MPI], [msmpi], [have_mpi=yes], [ + LIBS="${LIBS} -lmsmpi" + ]) ], [ - PKG_CHECK_MODULES([MPI], [mpi-fort], [have_mpi=yes], [have_mpi=no]) + PKG_CHECK_MODULES([MPI], [mpi-fort], [have_mpi=yes], [ + LIBS="${LIBS} -lmpi_usempif08 -lmpi_mpifh -lmpi" + ]) ] ) - AS_IF([test "x$have_mpi" = "xyes"], - [ + AS_IF([test "x$have_mpi" = "xyes"], [ CFLAGS="${CFLAGS} ${MPI_CFLAGS} -DRAMS_MPI -fallow-invalid-boz -fallow-argument-mismatch" LIBS="${LIBS} ${MPI_LIBS}" - ], - [ - AC_PROG_FC([gfortran]) + ], [ + # If pkg-config is not found try to link directly + CFLAGS="${CFLAGS} -DRAMS_MPI -fallow-invalid-boz -fallow-argument-mismatch" + ] ) - ] -) - -AS_IF([test "x$have_hdf5" = "xyes"], - [ - LIBS="${LIBS} ${hdf5_fortran_LIBS} ${MPILIBS}" - CFLAGS="${CFLAGS} ${hdf5_fortran_CFLAGS}" - ], - [ - PKG_CHECK_MODULES([HDF5], [hdf5], [have_hdf5=yes], [have_hdf5=no]) - - AS_IF([test "x$have_hdf5" = "xyes"], - [ - LIBS="${LIBS} ${HDF5_LIBS} -lhdf5 -lhdf5_fortran" - FCFLAGS="${CFLAGS} ${HDF5_CFLAGS}" - - AC_MSG_CHECKING([for HDF5 support in Fortran]) - AC_LANG_PUSH([Fortran]) - - AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[ - use hdf5 - integer :: hdferr - call h5open_f(hdferr) - call h5close_f(hdferr) - ]])], - [AC_MSG_RESULT([yes]) - HDF5_OK=yes], - [AC_MSG_RESULT([no]) - HDF5_OK=no]) - - AC_LANG_POP([Fortran]) - ], - [have_hdf5=no]) + FCFLAGS="${CFLAGS}" + + AC_MSG_CHECKING([for MPI can link in Fortran]) + AC_LINK_IFELSE([ + AC_LANG_PROGRAM([], [[ + program test_mpi + use mpi + integer :: ierr, rank + call MPI_Init(ierr) + call MPI_Comm_rank(MPI_COMM_WORLD, rank, ierr) + call MPI_Finalize(ierr) + end program test_mpi + ]], [[]] + )], [ + AC_MSG_RESULT([yes]) + ], [ + AC_MSG_RESULT([no]) + CFLAGS="${ORIGINAL_CFLAGS}" + LIBS="${ORIGINAL_LIBS}" + AC_PROG_FC([gfortran]) + ] + ) ] ) -AS_IF([test "x$have_hdf5" = "xno"],[ - AC_MSG_ERROR([ -HDF5 library not found! - -Please install HDF5 library and try again: - - Debian: sudo apt-get install libhdf5-dev - Fedora: sudo dnf install hdf5-devel - CentOS: sudo yum install hdf5-devel - MacOS: brew install hdf5 - Windows MinGW: pacman -S mingw-w64-x86_64-hdf5 - ]) -]) - - AC_SUBST([CC]) AC_SUBST([FC]) AC_SUBST([SHLIB]) From c189e3317ad8213d5f3b8638b5ffd453cf0cc856 Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Mon, 1 Jul 2024 11:10:12 -0400 Subject: [PATCH 08/11] Add includde EDR EDTS and R-utils to EXTRA_DIST --- Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.am b/Makefile.am index 1aa1a8e81..ee2422127 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,5 +28,8 @@ libed2_a_SOURCES = $(SOURCES) # Additional Fortran clean files CLEANFILES = *.mod +# Additional files for distribution +EXTRA_DIST = ED/src/include EDR EDTS R-utils + # Include the dependency makefile include ED/build/shell/dependency.mk From 9df6749f06b322f1712c205fd2d5bc10db6ff16c Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Mon, 1 Jul 2024 12:11:43 -0400 Subject: [PATCH 09/11] Change include mpi.h to use mpi --- ED/build/shell/dependency.mk | 208 ++++++++++++++++++++++++++++++++ ED/build/shell/sources.mk | 1 + ED/src/driver/ed_1st.F90 | 10 +- ED/src/driver/ed_driver.F90 | 7 +- ED/src/driver/ed_model.F90 | 5 +- ED/src/driver/edmain.F90 | 10 +- ED/src/init/ed_init.F90 | 4 +- ED/src/init/ed_init_atm.F90 | 5 +- ED/src/io/ed_print.F90 | 5 +- ED/src/io/h5_output.F90 | 8 +- ED/src/memory/ed_state_vars.F90 | 4 +- ED/src/mpi/ed_mpass_init.F90 | 53 +++++--- ED/src/utils/fatal_error.F90 | 8 +- 13 files changed, 279 insertions(+), 49 deletions(-) create mode 100644 ED/build/shell/dependency.mk create mode 100644 ED/build/shell/sources.mk diff --git a/ED/build/shell/dependency.mk b/ED/build/shell/dependency.mk new file mode 100644 index 000000000..da5060653 --- /dev/null +++ b/ED/build/shell/dependency.mk @@ -0,0 +1,208 @@ +ed_1st.mod: ED/src/driver/ed_1st.o +ED/src/driver/ed_1st.o: ed_mem_alloc.mod ed_met_driver.mod ed_misc_coms.mod ed_para_coms.mod ed_state_vars.mod +ed_driver.mod: ED/src/driver/ed_driver.o +ED/src/driver/ed_driver.o: canopy_radiation_coms.mod consts_coms.mod detailed_coms.mod ed_init.mod ed_init_history.mod ed_met_driver.mod ed_misc_coms.mod ed_node_coms.mod ed_state_vars.mod fuse_fiss_utils.mod grid_coms.mod hrzshade_utils.mod lsm_hyd.mod phenology_aux.mod random_utils.mod soil_coms.mod update_derived_utils.mod +ed_met_driver.mod: ED/src/driver/ed_met_driver.o +ED/src/driver/ed_met_driver.o: canopy_air_coms.mod canopy_radiation_coms.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_node_coms.mod ed_state_vars.mod grid_coms.mod hdf5_utils.mod lapse.mod met_driver_coms.mod pft_coms.mod radiate_utils.mod random_utils.mod therm_lib.mod update_derived_utils.mod +ed_model.mod: ED/src/driver/ed_model.o +ED/src/driver/ed_model.o: average_utils.mod budget_utils.mod consts_coms.mod ed_init.mod ed_met_driver.mod ed_misc_coms.mod ed_node_coms.mod ed_state_vars.mod ed_type_init.mod edio.mod euler_driver.mod grid_coms.mod heun_driver.mod hybrid_driver.mod lsm_hyd.mod mem_polygons.mod radiate_driver.mod rk4_coms.mod rk4_driver.mod rk4_integ_utils.mod soil_respiration.mod stable_cohorts.mod update_derived_utils.mod vegetation_dynamics.mod +bdf2_solver.mod: ED/src/dynamics/bdf2_solver.o +ED/src/dynamics/bdf2_solver.o: consts_coms.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod grid_coms.mod rk4_coms.mod soil_coms.mod therm_lib8.mod +canopy_struct_dynamics.mod: ED/src/dynamics/canopy_struct_dynamics.o +ED/src/dynamics/canopy_struct_dynamics.o: allometry.mod canopy_air_coms.mod canopy_layer_coms.mod consts_coms.mod ed_misc_coms.mod ed_state_vars.mod grid_coms.mod met_driver_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod rk4_coms.mod soil_coms.mod +disturbance.mod: ED/src/dynamics/disturbance.o +ED/src/dynamics/disturbance.o: allometry.mod consts_coms.mod detailed_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod ed_type_init.mod forestry.mod fuse_fiss_utils.mod fusion_fission_coms.mod grid_coms.mod mem_polygons.mod met_driver_coms.mod mortality.mod pft_coms.mod phenology_aux.mod plant_hydro.mod stable_cohorts.mod therm_lib.mod update_derived_utils.mod +euler_driver.mod: ED/src/dynamics/euler_driver.o +ED/src/dynamics/euler_driver.o: budget_utils.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_para_coms.mod ed_state_vars.mod grid_coms.mod met_driver_coms.mod photosyn_driv.mod plant_hydro.mod rk4_coms.mod rk4_copy_patch.mod rk4_derivs.mod rk4_integ_utils.mod rk4_misc.mod soil_coms.mod soil_respiration.mod stem_resp_driv.mod therm_lib.mod therm_lib8.mod update_derived_utils.mod +events.mod: ED/src/dynamics/events.o +ED/src/dynamics/events.o: allometry.mod consts_coms.mod disturbance.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod ed_type_init.mod fuse_fiss_utils.mod grid_coms.mod met_driver_coms.mod pft_coms.mod plant_hydro.mod rk4_integ_utils.mod stable_cohorts.mod therm_lib.mod update_derived_utils.mod +farq_katul.mod: ED/src/dynamics/farq_katul.o +ED/src/dynamics/farq_katul.o: c34constants.mod consts_coms.mod ed_misc_coms.mod farq_leuning.mod pft_coms.mod physiology_coms.mod rk4_coms.mod +farq_leuning.mod: ED/src/dynamics/farq_leuning.o +ED/src/dynamics/farq_leuning.o: c34constants.mod consts_coms.mod pft_coms.mod physiology_coms.mod rk4_coms.mod therm_lib8.mod +fire.mod: ED/src/dynamics/fire.o +ED/src/dynamics/fire.o: consts_coms.mod disturb_coms.mod ed_misc_coms.mod ed_state_vars.mod grid_coms.mod pft_coms.mod soil_coms.mod +forestry.mod: ED/src/dynamics/forestry.o +ED/src/dynamics/forestry.o: consts_coms.mod detailed_coms.mod disturb_coms.mod ed_max_dims.mod ed_state_vars.mod fuse_fiss_utils.mod +growth_balive.mod: ED/src/dynamics/growth_balive.o +ED/src/dynamics/growth_balive.o: allometry.mod budget_utils.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod fuse_fiss_utils.mod met_driver_coms.mod mortality.mod pft_coms.mod physiology_coms.mod plant_hydro.mod stable_cohorts.mod update_derived_utils.mod +heun_driver.mod: ED/src/dynamics/heun_driver.o +ED/src/dynamics/heun_driver.o: budget_utils.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_para_coms.mod ed_state_vars.mod grid_coms.mod met_driver_coms.mod photosyn_driv.mod plant_hydro.mod rk4_coms.mod rk4_copy_patch.mod rk4_derivs.mod rk4_integ_utils.mod rk4_misc.mod soil_coms.mod soil_respiration.mod stem_resp_driv.mod therm_lib.mod therm_lib8.mod update_derived_utils.mod +hybrid_driver.mod: ED/src/dynamics/hybrid_driver.o +ED/src/dynamics/hybrid_driver.o: bdf2_solver.mod budget_utils.mod consts_coms.mod ed_misc_coms.mod ed_para_coms.mod ed_state_vars.mod grid_coms.mod met_driver_coms.mod photosyn_driv.mod plant_hydro.mod rk4_coms.mod rk4_copy_patch.mod rk4_derivs.mod rk4_integ_utils.mod rk4_misc.mod soil_coms.mod soil_respiration.mod stem_resp_driv.mod therm_lib.mod therm_lib8.mod update_derived_utils.mod +lsm_hyd.mod: ED/src/dynamics/lsm_hyd.o +ED/src/dynamics/lsm_hyd.o: consts_coms.mod ed_misc_coms.mod ed_node_coms.mod ed_state_vars.mod grid_coms.mod hydrology_coms.mod hydrology_constants.mod pft_coms.mod soil_coms.mod therm_lib.mod +mortality.mod: ED/src/dynamics/mortality.o +ED/src/dynamics/mortality.o: consts_coms.mod disturb_coms.mod ed_max_dims.mod ed_state_vars.mod pft_coms.mod physiology_coms.mod +multiple_scatter.mod: ED/src/dynamics/multiple_scatter.o +ED/src/dynamics/multiple_scatter.o: canopy_radiation_coms.mod consts_coms.mod ed_max_dims.mod rk4_coms.mod +old_twostream_rad.mod: ED/src/dynamics/old_twostream_rad.o +ED/src/dynamics/old_twostream_rad.o: canopy_radiation_coms.mod consts_coms.mod ed_max_dims.mod rk4_coms.mod +phenology_aux.mod: ED/src/dynamics/phenology_aux.o +ED/src/dynamics/phenology_aux.o: allometry.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod grid_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod plant_hydro.mod soil_coms.mod stable_cohorts.mod therm_lib.mod +phenology_driv.mod: ED/src/dynamics/phenology_driv.o +ED/src/dynamics/phenology_driv.o: allometry.mod budget_utils.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod grid_coms.mod pft_coms.mod phenology_aux.mod phenology_coms.mod plant_hydro.mod stable_cohorts.mod therm_lib.mod +photosyn_driv.mod: ED/src/dynamics/photosyn_driv.o +ED/src/dynamics/photosyn_driv.o: allometry.mod canopy_air_coms.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod farq_katul.mod farq_leuning.mod met_driver_coms.mod pft_coms.mod physiology_coms.mod rk4_coms.mod soil_coms.mod therm_lib.mod +plant_hydro.mod: ED/src/dynamics/plant_hydro.o +ED/src/dynamics/plant_hydro.o: allometry.mod consts_coms.mod ed_misc_coms.mod ed_state_vars.mod grid_coms.mod pft_coms.mod physiology_coms.mod rk4_coms.mod soil_coms.mod +radiate_driver.mod: ED/src/dynamics/radiate_driver.o +ED/src/dynamics/radiate_driver.o: allometry.mod canopy_layer_coms.mod canopy_radiation_coms.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_para_coms.mod ed_state_vars.mod grid_coms.mod multiple_scatter.mod old_twostream_rad.mod radiate_utils.mod rk4_coms.mod soil_coms.mod twostream_rad.mod +reproduction.mod: ED/src/dynamics/reproduction.o +ED/src/dynamics/reproduction.o: allometry.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod ed_type_init.mod fuse_fiss_utils.mod fusion_fission_coms.mod grid_coms.mod mem_polygons.mod met_driver_coms.mod pft_coms.mod phenology_aux.mod phenology_coms.mod physiology_coms.mod plant_hydro.mod stable_cohorts.mod update_derived_utils.mod +rk4_copy_patch.mod: ED/src/dynamics/rk4_copy_patch.o +ED/src/dynamics/rk4_copy_patch.o: allometry.mod budget_utils.mod canopy_air_coms.mod canopy_struct_dynamics.mod consts_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod grid_coms.mod phenology_coms.mod physiology_coms.mod plant_hydro.mod rk4_coms.mod rk4_misc.mod soil_coms.mod therm_lib.mod therm_lib8.mod +rk4_derivs.mod: ED/src/dynamics/rk4_derivs.o +ED/src/dynamics/rk4_derivs.o: budget_utils.mod canopy_struct_dynamics.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod grid_coms.mod physiology_coms.mod rk4_coms.mod soil_coms.mod therm_lib8.mod +rk4_driver.mod: ED/src/dynamics/rk4_driver.o +ED/src/dynamics/rk4_driver.o: budget_utils.mod ed_misc_coms.mod ed_para_coms.mod ed_state_vars.mod grid_coms.mod met_driver_coms.mod photosyn_driv.mod plant_hydro.mod rk4_coms.mod rk4_copy_patch.mod rk4_integ_utils.mod rk4_misc.mod soil_respiration.mod stem_resp_driv.mod therm_lib.mod update_derived_utils.mod +rk4_integ_utils.mod: ED/src/dynamics/rk4_integ_utils.o +ED/src/dynamics/rk4_integ_utils.o: c34constants.mod canopy_air_coms.mod canopy_layer_coms.mod canopy_radiation_coms.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_para_coms.mod ed_state_vars.mod grid_coms.mod hydrology_coms.mod physiology_coms.mod rk4_coms.mod rk4_copy_patch.mod rk4_derivs.mod rk4_misc.mod soil_coms.mod therm_lib8.mod +rk4_misc.mod: ED/src/dynamics/rk4_misc.o +ED/src/dynamics/rk4_misc.o: budget_utils.mod canopy_struct_dynamics.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod grid_coms.mod pft_coms.mod physiology_coms.mod plant_hydro.mod rk4_coms.mod soil_coms.mod therm_lib.mod therm_lib8.mod +soil_respiration.mod: ED/src/dynamics/soil_respiration.o +ED/src/dynamics/soil_respiration.o: budget_utils.mod consts_coms.mod decomp_coms.mod ed_misc_coms.mod ed_state_vars.mod farq_leuning.mod grid_coms.mod pft_coms.mod physiology_coms.mod rk4_coms.mod soil_coms.mod therm_lib.mod +stem_resp_driv.mod: ED/src/dynamics/stem_resp_driv.o +ED/src/dynamics/stem_resp_driv.o: consts_coms.mod ed_misc_coms.mod ed_state_vars.mod farq_leuning.mod pft_coms.mod physiology_coms.mod rk4_coms.mod +structural_growth.mod: ED/src/dynamics/structural_growth.o +ED/src/dynamics/structural_growth.o: allometry.mod budget_utils.mod consts_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod fuse_fiss_utils.mod pft_coms.mod physiology_coms.mod plant_hydro.mod stable_cohorts.mod update_derived_utils.mod +twostream_rad.mod: ED/src/dynamics/twostream_rad.o +ED/src/dynamics/twostream_rad.o: canopy_radiation_coms.mod consts_coms.mod ed_max_dims.mod rk4_coms.mod +vegetation_dynamics.mod: ED/src/dynamics/vegetation_dynamics.o +ED/src/dynamics/vegetation_dynamics.o: average_utils.mod budget_utils.mod canopy_radiation_coms.mod consts_coms.mod disturbance.mod ed_cn_utils.mod ed_misc_coms.mod ed_state_vars.mod fire.mod fuse_fiss_utils.mod fusion_fission_coms.mod grid_coms.mod growth_balive.mod hrzshade_utils.mod mem_polygons.mod phenology_driv.mod reproduction.mod soil_respiration.mod structural_growth.mod update_derived_utils.mod +ed_bigleaf_init.mod: ED/src/init/ed_bigleaf_init.o +ED/src/init/ed_bigleaf_init.o: allometry.mod consts_coms.mod ed_max_dims.mod ed_node_coms.mod ed_state_vars.mod ed_type_init.mod fuse_fiss_utils.mod grid_coms.mod pft_coms.mod physiology_coms.mod +ed_init.mod: ED/src/init/ed_init.o +ED/src/init/ed_init.o: consts_coms.mod ed_bigleaf_init.mod ed_max_dims.mod ed_misc_coms.mod ed_nbg_init.mod ed_node_coms.mod ed_state_vars.mod ed_work_vars.mod grid_coms.mod landuse_init.mod mem_polygons.mod phenology_startup.mod rk4_coms.mod soil_coms.mod +ed_init_atm.mod: ED/src/init/ed_init_atm.o +ED/src/init/ed_init_atm.o: canopy_layer_coms.mod canopy_radiation_coms.mod canopy_struct_dynamics.mod consts_coms.mod ed_misc_coms.mod ed_node_coms.mod ed_para_coms.mod ed_state_vars.mod ed_therm_lib.mod fuse_fiss_utils.mod fusion_fission_coms.mod grid_coms.mod hrzshade_utils.mod met_driver_coms.mod soil_coms.mod stable_cohorts.mod therm_lib.mod update_derived_utils.mod +ed_nbg_init.mod: ED/src/init/ed_nbg_init.o +ED/src/init/ed_nbg_init.o: allometry.mod consts_coms.mod decomp_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_type_init.mod fuse_fiss_utils.mod grid_coms.mod pft_coms.mod physiology_coms.mod +ed_params.mod: ED/src/init/ed_params.o +ED/src/init/ed_params.o: allometry.mod budget_utils.mod canopy_air_coms.mod canopy_layer_coms.mod canopy_radiation_coms.mod consts_coms.mod decomp_coms.mod detailed_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_therm_lib.mod farq_leuning.mod fusion_fission_coms.mod grid_coms.mod hydrology_coms.mod met_driver_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod plant_hydro.mod rk4_coms.mod soil_coms.mod +ed_type_init.mod: ED/src/init/ed_type_init.o +ED/src/init/ed_type_init.o: allometry.mod canopy_air_coms.mod consts_coms.mod ed_cn_utils.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod grid_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod plant_hydro.mod rk4_coms.mod soil_coms.mod therm_lib.mod +landuse_init.mod: ED/src/init/landuse_init.o +ED/src/init/landuse_init.o: consts_coms.mod detailed_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod grid_coms.mod +phenology_startup.mod: ED/src/init/phenology_startup.o +ED/src/init/phenology_startup.o: ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod grid_coms.mod phenology_aux.mod phenology_coms.mod +average_utils.mod: ED/src/io/average_utils.o +ED/src/io/average_utils.o: consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod grid_coms.mod met_driver_coms.mod physiology_coms.mod soil_coms.mod therm_lib.mod +edio.mod: ED/src/io/edio.o +ED/src/io/edio.o: average_utils.mod ed_misc_coms.mod ed_print.mod ed_state_vars.mod grid_coms.mod +ed_init_history.mod: ED/src/io/ed_init_history.o +ED/src/io/ed_init_history.o: ed_max_dims.mod ed_misc_coms.mod ed_node_coms.mod ed_state_vars.mod fusion_fission_coms.mod grid_coms.mod hdf5_coms.mod landuse_init.mod phenology_startup.mod soil_coms.mod +ed_load_namelist.mod: ED/src/io/ed_load_namelist.o +ED/src/io/ed_load_namelist.o: canopy_air_coms.mod canopy_layer_coms.mod canopy_radiation_coms.mod consts_coms.mod decomp_coms.mod detailed_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_para_coms.mod ename_coms.mod fusion_fission_coms.mod grid_coms.mod mem_polygons.mod met_driver_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod rk4_coms.mod soil_coms.mod +ed_opspec.mod: ED/src/io/ed_opspec.o +ED/src/io/ed_opspec.o: canopy_air_coms.mod canopy_layer_coms.mod canopy_radiation_coms.mod consts_coms.mod decomp_coms.mod detailed_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_para_coms.mod fusion_fission_coms.mod grid_coms.mod mem_polygons.mod met_driver_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod rk4_coms.mod soil_coms.mod +ed_print.mod: ED/src/io/ed_print.o +ED/src/io/ed_print.o: ed_max_dims.mod ed_misc_coms.mod ed_node_coms.mod ed_state_vars.mod ed_var_tables.mod +ed_read_ed10_20_history.mod: ED/src/io/ed_read_ed10_20_history.o +ED/src/io/ed_read_ed10_20_history.o: allometry.mod consts_coms.mod decomp_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_type_init.mod fuse_fiss_utils.mod grid_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod update_derived_utils.mod +ed_read_ed21_history.mod: ED/src/io/ed_read_ed21_history.o +ED/src/io/ed_read_ed21_history.o: allometry.mod consts_coms.mod decomp_coms.mod disturb_coms.mod ed_init.mod ed_init_history.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_type_init.mod fuse_fiss_utils.mod grid_coms.mod hdf5_coms.mod met_driver_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod soil_coms.mod update_derived_utils.mod +ed_xml_config.mod: ED/src/io/ed_xml_config.o +ED/src/io/ed_xml_config.o: budget_utils.mod canopy_air_coms.mod canopy_radiation_coms.mod decomp_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod fusion_fission_coms.mod grid_coms.mod hydrology_coms.mod met_driver_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod rk4_coms.mod soil_coms.mod +h5_output.mod: ED/src/io/h5_output.o +ED/src/io/h5_output.o: ed_max_dims.mod ed_misc_coms.mod ed_node_coms.mod ed_state_vars.mod ed_var_tables.mod fusion_fission_coms.mod grid_coms.mod hdf5_coms.mod +leaf_database.mod: ED/src/io/leaf_database.o +ED/src/io/leaf_database.o: grid_coms.mod hdf5_utils.mod soil_coms.mod +c34constants.mod: ED/src/memory/c34constants.o +canopy_air_coms.mod: ED/src/memory/canopy_air_coms.o +ED/src/memory/canopy_air_coms.o: consts_coms.mod therm_lib8.mod +canopy_layer_coms.mod: ED/src/memory/canopy_layer_coms.o +canopy_radiation_coms.mod: ED/src/memory/canopy_radiation_coms.o +ED/src/memory/canopy_radiation_coms.o: ed_max_dims.mod +consts_coms.mod: ED/src/memory/consts_coms.o +decomp_coms.mod: ED/src/memory/decomp_coms.o +detailed_coms.mod: ED/src/memory/detailed_coms.o +disturb_coms.mod: ED/src/memory/disturb_coms.o +ED/src/memory/disturb_coms.o: ed_max_dims.mod +ed_max_dims.mod: ED/src/memory/ed_max_dims.o +ed_mem_alloc.mod: ED/src/memory/ed_mem_alloc.o +ED/src/memory/ed_mem_alloc.o: ed_max_dims.mod ed_node_coms.mod ed_state_vars.mod ed_work_vars.mod grid_coms.mod mem_polygons.mod +ed_misc_coms.mod: ED/src/memory/ed_misc_coms.o +ED/src/memory/ed_misc_coms.o: ed_max_dims.mod +ed_state_vars.mod: ED/src/memory/ed_state_vars.o +ED/src/memory/ed_state_vars.o: disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_node_coms.mod ed_var_tables.mod fusion_fission_coms.mod grid_coms.mod met_driver_coms.mod phenology_coms.mod soil_coms.mod +ed_var_tables.mod: ED/src/memory/ed_var_tables.o +ED/src/memory/ed_var_tables.o: ed_max_dims.mod +ed_work_vars.mod: ED/src/memory/ed_work_vars.o +ED/src/memory/ed_work_vars.o: ed_max_dims.mod +ename_coms.mod: ED/src/memory/ename_coms.o +ED/src/memory/ename_coms.o: ed_max_dims.mod +fusion_fission_coms.mod: ED/src/memory/fusion_fission_coms.o +ED/src/memory/fusion_fission_coms.o: ed_max_dims.mod +grid_coms.mod: ED/src/memory/grid_coms.o +ED/src/memory/grid_coms.o: ed_max_dims.mod +hdf5_coms.mod: ED/src/memory/hdf5_coms.o +hydrology_coms.mod: ED/src/memory/hydrology_coms.o +hydrology_constants.mod: ED/src/memory/hydrology_constants.o +mem_polygons.mod: ED/src/memory/mem_polygons.o +ED/src/memory/mem_polygons.o: ed_max_dims.mod +met_driver_coms.mod: ED/src/memory/met_driver_coms.o +ED/src/memory/met_driver_coms.o: ed_max_dims.mod +pft_coms.mod: ED/src/memory/pft_coms.o +ED/src/memory/pft_coms.o: ed_max_dims.mod +phenology_coms.mod: ED/src/memory/phenology_coms.o +ED/src/memory/phenology_coms.o: ed_max_dims.mod +physiology_coms.mod: ED/src/memory/physiology_coms.o +ED/src/memory/physiology_coms.o: ed_max_dims.mod +rk4_coms.mod: ED/src/memory/rk4_coms.o +ED/src/memory/rk4_coms.o: ed_max_dims.mod grid_coms.mod +soil_coms.mod: ED/src/memory/soil_coms.o +ED/src/memory/soil_coms.o: consts_coms.mod ed_max_dims.mod grid_coms.mod +ed_mpass_init.mod: ED/src/mpi/ed_mpass_init.o +ED/src/mpi/ed_mpass_init.o: canopy_air_coms.mod canopy_layer_coms.mod canopy_radiation_coms.mod decomp_coms.mod detailed_coms.mod disturb_coms.mod ed_max_dims.mod ed_mem_alloc.mod ed_misc_coms.mod ed_node_coms.mod ed_para_coms.mod ed_state_vars.mod ed_work_vars.mod fusion_fission_coms.mod grid_coms.mod mem_polygons.mod met_driver_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod rk4_coms.mod soil_coms.mod +ed_node_coms.mod: ED/src/mpi/ed_node_coms.o +ED/src/mpi/ed_node_coms.o: ed_max_dims.mod +ed_para_coms.mod: ED/src/mpi/ed_para_coms.o +ED/src/mpi/ed_para_coms.o: ed_max_dims.mod +ed_para_init.mod: ED/src/mpi/ed_para_init.o +ED/src/mpi/ed_para_init.o: ed_init_history.mod ed_max_dims.mod ed_misc_coms.mod ed_node_coms.mod ed_para_coms.mod ed_work_vars.mod grid_coms.mod hdf5_coms.mod mem_polygons.mod soil_coms.mod +allometry.mod: ED/src/utils/allometry.o +ED/src/utils/allometry.o: consts_coms.mod ed_misc_coms.mod ed_state_vars.mod grid_coms.mod pft_coms.mod rk4_coms.mod soil_coms.mod therm_lib.mod +budget_utils.mod: ED/src/utils/budget_utils.o +ED/src/utils/budget_utils.o: consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod grid_coms.mod rk4_coms.mod soil_coms.mod therm_lib.mod +charutils.mod: ED/src/utils/charutils.o +dateutils.mod: ED/src/utils/dateutils.o +ED/src/utils/dateutils.o: consts_coms.mod +ed_cn_utils.mod: ED/src/utils/ed_cn_utils.o +ED/src/utils/ed_cn_utils.o: ed_max_dims.mod ed_state_vars.mod pft_coms.mod +ed_filelist.mod: ED/src/utils/ed_filelist.o +ED/src/utils/ed_filelist.o: ed_max_dims.mod +ed_grid.mod: ED/src/utils/ed_grid.o +ED/src/utils/ed_grid.o: consts_coms.mod ed_max_dims.mod ed_node_coms.mod grid_coms.mod +ed_therm_lib.mod: ED/src/utils/ed_therm_lib.o +ED/src/utils/ed_therm_lib.o: canopy_air_coms.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod grid_coms.mod pft_coms.mod rk4_coms.mod soil_coms.mod therm_lib.mod therm_lib8.mod +fatal_error.mod: ED/src/utils/fatal_error.o +ED/src/utils/fatal_error.o: ed_node_coms.mod +fuse_fiss_utils.mod: ED/src/utils/fuse_fiss_utils.o +ED/src/utils/fuse_fiss_utils.o: allometry.mod budget_utils.mod consts_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_node_coms.mod ed_state_vars.mod ed_therm_lib.mod ed_type_init.mod fusion_fission_coms.mod grid_coms.mod mem_polygons.mod met_driver_coms.mod pft_coms.mod plant_hydro.mod rk4_coms.mod soil_coms.mod stable_cohorts.mod therm_lib.mod update_derived_utils.mod +great_circle.mod: ED/src/utils/great_circle.o +ED/src/utils/great_circle.o: consts_coms.mod +hdf5_utils.mod: ED/src/utils/hdf5_utils.o +ED/src/utils/hdf5_utils.o: hdf5_coms.mod +hrzshade_utils.mod: ED/src/utils/hrzshade_utils.o +ED/src/utils/hrzshade_utils.o: allometry.mod canopy_radiation_coms.mod consts_coms.mod disturb_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod pft_coms.mod random_utils.mod rk4_coms.mod +invmondays.mod: ED/src/utils/invmondays.o +ED/src/utils/invmondays.o: ed_misc_coms.mod +lapse.mod: ED/src/utils/lapse.o +ED/src/utils/lapse.o: consts_coms.mod ed_misc_coms.mod ed_state_vars.mod met_driver_coms.mod +libxml2f90.f90_pp.mod: ED/src/utils/libxml2f90.f90_pp.o +numutils.mod: ED/src/utils/numutils.o +ED/src/utils/numutils.o: consts_coms.mod +radiate_utils.mod: ED/src/utils/radiate_utils.o +ED/src/utils/radiate_utils.o: canopy_radiation_coms.mod consts_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod met_driver_coms.mod phenology_coms.mod update_derived_utils.mod +random_utils.mod: ED/src/utils/random_utils.o +rsys.mod: ED/src/utils/rsys.o +stable_cohorts.mod: ED/src/utils/stable_cohorts.o +ED/src/utils/stable_cohorts.o: allometry.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod pft_coms.mod physiology_coms.mod plant_hydro.mod +therm_lib.mod: ED/src/utils/therm_lib.o +ED/src/utils/therm_lib.o: consts_coms.mod +therm_lib8.mod: ED/src/utils/therm_lib8.o +ED/src/utils/therm_lib8.o: consts_coms.mod therm_lib.mod +update_derived_utils.mod: ED/src/utils/update_derived_utils.o +ED/src/utils/update_derived_utils.o: allometry.mod canopy_air_coms.mod canopy_radiation_coms.mod consts_coms.mod detailed_coms.mod ed_max_dims.mod ed_misc_coms.mod ed_state_vars.mod ed_therm_lib.mod fusion_fission_coms.mod grid_coms.mod pft_coms.mod phenology_coms.mod physiology_coms.mod soil_coms.mod therm_lib.mod +utils_f.mod: ED/src/utils/utils_f.o diff --git a/ED/build/shell/sources.mk b/ED/build/shell/sources.mk new file mode 100644 index 000000000..e1d63ed08 --- /dev/null +++ b/ED/build/shell/sources.mk @@ -0,0 +1 @@ +SOURCES = ED/src/driver/ed_1st.F90 ED/src/driver/ed_driver.F90 ED/src/driver/ed_met_driver.f90 ED/src/driver/ed_model.F90 ED/src/dynamics/bdf2_solver.f90 ED/src/dynamics/canopy_struct_dynamics.f90 ED/src/dynamics/disturbance.f90 ED/src/dynamics/euler_driver.f90 ED/src/dynamics/events.f90 ED/src/dynamics/farq_katul.f90 ED/src/dynamics/farq_leuning.f90 ED/src/dynamics/fire.f90 ED/src/dynamics/forestry.f90 ED/src/dynamics/growth_balive.f90 ED/src/dynamics/heun_driver.f90 ED/src/dynamics/hybrid_driver.f90 ED/src/dynamics/lsm_hyd.f90 ED/src/dynamics/mortality.f90 ED/src/dynamics/multiple_scatter.f90 ED/src/dynamics/old_twostream_rad.f90 ED/src/dynamics/phenology_aux.f90 ED/src/dynamics/phenology_driv.f90 ED/src/dynamics/photosyn_driv.f90 ED/src/dynamics/plant_hydro.f90 ED/src/dynamics/radiate_driver.f90 ED/src/dynamics/reproduction.f90 ED/src/dynamics/rk4_copy_patch.f90 ED/src/dynamics/rk4_derivs.f90 ED/src/dynamics/rk4_driver.F90 ED/src/dynamics/rk4_integ_utils.f90 ED/src/dynamics/rk4_misc.f90 ED/src/dynamics/soil_respiration.f90 ED/src/dynamics/stem_resp_driv.f90 ED/src/dynamics/structural_growth.f90 ED/src/dynamics/twostream_rad.f90 ED/src/dynamics/vegetation_dynamics.f90 ED/src/init/ed_bigleaf_init.f90 ED/src/init/ed_init.F90 ED/src/init/ed_init_atm.F90 ED/src/init/ed_nbg_init.f90 ED/src/init/ed_params.f90 ED/src/init/ed_type_init.f90 ED/src/init/landuse_init.f90 ED/src/init/phenology_startup.f90 ED/src/io/average_utils.f90 ED/src/io/edio.f90 ED/src/io/ed_init_history.f90 ED/src/io/ed_load_namelist.f90 ED/src/io/ed_opspec.F90 ED/src/io/ed_print.F90 ED/src/io/ed_read_ed10_20_history.f90 ED/src/io/ed_read_ed21_history.f90 ED/src/io/ed_xml_config.f90 ED/src/io/h5_output.F90 ED/src/io/leaf_database.f90 ED/src/memory/c34constants.f90 ED/src/memory/canopy_air_coms.f90 ED/src/memory/canopy_layer_coms.f90 ED/src/memory/canopy_radiation_coms.f90 ED/src/memory/consts_coms.F90 ED/src/memory/decomp_coms.f90 ED/src/memory/detailed_coms.f90 ED/src/memory/disturb_coms.f90 ED/src/memory/ed_max_dims.F90 ED/src/memory/ed_mem_alloc.f90 ED/src/memory/ed_misc_coms.f90 ED/src/memory/ed_state_vars.F90 ED/src/memory/ed_var_tables.f90 ED/src/memory/ed_work_vars.f90 ED/src/memory/ename_coms.f90 ED/src/memory/fusion_fission_coms.f90 ED/src/memory/grid_coms.f90 ED/src/memory/hdf5_coms.f90 ED/src/memory/hydrology_coms.f90 ED/src/memory/hydrology_constants.f90 ED/src/memory/mem_polygons.f90 ED/src/memory/met_driver_coms.f90 ED/src/memory/pft_coms.f90 ED/src/memory/phenology_coms.f90 ED/src/memory/physiology_coms.f90 ED/src/memory/rk4_coms.f90 ED/src/memory/soil_coms.F90 ED/src/mpi/ed_mpass_init.F90 ED/src/mpi/ed_node_coms.f90 ED/src/mpi/ed_para_coms.f90 ED/src/mpi/ed_para_init.f90 ED/src/utils/allometry.f90 ED/src/utils/budget_utils.f90 ED/src/utils/charutils.f90 ED/src/utils/dateutils.f90 ED/src/utils/ed_cn_utils.f90 ED/src/utils/ed_filelist.F90 ED/src/utils/ed_grid.f90 ED/src/utils/ed_therm_lib.f90 ED/src/utils/fatal_error.F90 ED/src/utils/fuse_fiss_utils.f90 ED/src/utils/great_circle.f90 ED/src/utils/hdf5_utils.f90 ED/src/utils/hrzshade_utils.f90 ED/src/utils/invmondays.f90 ED/src/utils/lapse.f90 ED/src/utils/libxml2f90.f90_pp.f90 ED/src/utils/numutils.f90 ED/src/utils/radiate_utils.f90 ED/src/utils/random_utils.F90 ED/src/utils/rsys.F90 ED/src/utils/stable_cohorts.f90 ED/src/utils/therm_lib.f90 ED/src/utils/therm_lib8.f90 ED/src/utils/update_derived_utils.f90 ED/src/utils/utils_f.f90 ED/src/utils/utils_c.c diff --git a/ED/src/driver/ed_1st.F90 b/ED/src/driver/ed_1st.F90 index e2d3acd3b..5490bf5f1 100644 --- a/ED/src/driver/ed_1st.F90 +++ b/ED/src/driver/ed_1st.F90 @@ -23,12 +23,12 @@ subroutine ed_1st_master (ipara, nnodestotal,nslaves, headnode_num, max_threads, use ed_state_vars, only : allocate_edglobals & ! subroutine , filltab_alltypes ! ! subroutine +#if defined(RAMS_MPI) + use mpi +#endif implicit none !----- Pre-compiled variables from MPI. ------------------------------------------------! -#if defined(RAMS_MPI) - include 'mpif.h' -#endif !----- Arguments. ----------------------------------------------------------------------! integer , intent(in) :: ipara ! 0 if sequential run; 1 if parallel run integer , intent(in) :: nnodestotal ! total number of nodes on any run @@ -176,10 +176,12 @@ end subroutine ed_1st_master !------------------------------------------------------------------------------------------! subroutine ed_1st_node() use ed_mem_alloc, only : ed_memory_allocation ! ! subroutine +#if defined(RAMS_MPI) + use mpi +#endif implicit none !----- Pre-compiled variables from MPI. ------------------------------------------------! #if defined(RAMS_MPI) - include 'mpif.h' !----- Local variable (MPI only). ------------------------------------------------------! integer :: ierr #endif diff --git a/ED/src/driver/ed_driver.F90 b/ED/src/driver/ed_driver.F90 index 1c7ff8724..81b3f7cc4 100644 --- a/ED/src/driver/ed_driver.F90 +++ b/ED/src/driver/ed_driver.F90 @@ -36,11 +36,12 @@ subroutine ed_driver() use hrzshade_utils , only : init_cci_variables ! ! subroutine use canopy_radiation_coms, only : ihrzrad ! ! intent(in) use random_utils , only : init_random_seed ! ! subroutine - implicit none - !----- Included variables. -------------------------------------------------------------! #if defined(RAMS_MPI) - include 'mpif.h' ! MPI commons + use mpi ! MPI commons #endif + implicit none + + !----- Included variables. -------------------------------------------------------------! !----- Local variables. ----------------------------------------------------------------! character(len=12) :: c0 character(len=12) :: c1 diff --git a/ED/src/driver/ed_model.F90 b/ED/src/driver/ed_model.F90 index 77cc8f9d0..49bcb72a7 100644 --- a/ED/src/driver/ed_model.F90 +++ b/ED/src/driver/ed_model.F90 @@ -94,11 +94,10 @@ subroutine ed_model() use vegetation_dynamics , only : veg_dynamics_driver ! ! sub-routine use ed_type_init , only : ed_init_viable ! ! sub-routine use soil_respiration , only : zero_litter_inputs ! ! sub-routine - implicit none - !----- Common blocks. ------------------------------------------------------------------! #if defined(RAMS_MPI) - include 'mpif.h' + use mpi #endif + implicit none !----- Local variables. ----------------------------------------------------------------! type(simtime) :: daybefore character(len=28) :: fmthead diff --git a/ED/src/driver/edmain.F90 b/ED/src/driver/edmain.F90 index 53995bf4a..e74dad025 100644 --- a/ED/src/driver/edmain.F90 +++ b/ED/src/driver/edmain.F90 @@ -14,7 +14,10 @@ !------------------------------------------------------------------------------------------! program main !$ use omp_lib - implicit none +#if defined(RAMS_MPI) + use mpi +#endif + implicit none !---------------------------------------------------------------------------------------! ! Local constants. ! @@ -49,10 +52,7 @@ program main integer, dimension(64) :: thread_use integer, dimension(64) :: cpu_use integer, external :: findmycpu - !------ MPI interface. -----------------------------------------------------------------! -#if defined(RAMS_MPI) - include 'mpif.h' -#endif + !---------------------------------------------------------------------------------------! diff --git a/ED/src/init/ed_init.F90 b/ED/src/init/ed_init.F90 index b4913d66c..48a149ae4 100644 --- a/ED/src/init/ed_init.F90 +++ b/ED/src/init/ed_init.F90 @@ -319,10 +319,10 @@ subroutine load_ecosystem_state() use ed_node_coms , only : mynum ! ! intent(in) #endif - implicit none #if defined(RAMS_MPI) - include 'mpif.h' + use mpi #endif + implicit none !----- Local variables --------------------------------------------------------------! integer :: igr integer :: ping diff --git a/ED/src/init/ed_init_atm.F90 b/ED/src/init/ed_init_atm.F90 index 65cf07ee4..041ab13d0 100644 --- a/ED/src/init/ed_init_atm.F90 +++ b/ED/src/init/ed_init_atm.F90 @@ -33,6 +33,7 @@ subroutine ed_init_atm() , terminate_cohorts & ! subroutine , split_cohorts ! ! subroutine #if defined(RAMS_MPI) + use mpi use ed_node_coms , only : nnodetot & ! intent(in) , mynum & ! intent(in) , sendnum & ! intent(in) @@ -95,10 +96,6 @@ subroutine ed_init_atm() !----- Local variables (MPI only). -----------------------------------------------------! #if defined(RAMS_MPI) integer :: ierr -#endif - !----- Add the MPI common block. -------------------------------------------------------! -#if defined(RAMS_MPI) - include 'mpif.h' #endif !---------------------------------------------------------------------------------------! diff --git a/ED/src/io/ed_print.F90 b/ED/src/io/ed_print.F90 index aeb2115b8..badb0e998 100644 --- a/ED/src/io/ed_print.F90 +++ b/ED/src/io/ed_print.F90 @@ -48,11 +48,12 @@ subroutine print_fields(ifm,cgrid) use ed_var_tables, only : vt_info & ! intent(in) , num_var ! ! intent(in) use ed_max_dims , only : str_len_short ! ! intent(in) - implicit none + !----- Standard common blocks. ------------------------------------------------------! #if defined(RAMS_MPI) - include 'mpif.h' + use mpi #endif + implicit none !----- Arguments. -------------------------------------------------------------------! integer , intent(in) :: ifm type(edtype) , target :: cgrid diff --git a/ED/src/io/h5_output.F90 b/ED/src/io/h5_output.F90 index 209b184aa..943e3b1ce 100644 --- a/ED/src/io/h5_output.F90 +++ b/ED/src/io/h5_output.F90 @@ -48,12 +48,12 @@ subroutine h5_output(vtype) , sitetype & ! structure , patchtype & ! structure , gdpy ! ! intent(in) - implicit none - - !------ Include standard common blocks. ------------------------------------------------! + + !------ Include standard common blocks. ------------------------------------------------! #if defined(RAMS_MPI) - include 'mpif.h' + use mpi #endif + implicit none !------ Arguments. ---------------------------------------------------------------------! character(len=*) , intent(in) :: vtype !------ Local variables. ---------------------------------------------------------------! diff --git a/ED/src/memory/ed_state_vars.F90 b/ED/src/memory/ed_state_vars.F90 index d27c9f9b2..dad2957f2 100644 --- a/ED/src/memory/ed_state_vars.F90 +++ b/ED/src/memory/ed_state_vars.F90 @@ -12774,11 +12774,11 @@ subroutine filltab_alltypes #endif use ed_max_dims , only : maxgrds & ! intent(in) , maxmach ! ! intent(in) - implicit none #if defined(RAMS_MPI) - include 'mpif.h' + use mpi #endif +implicit none !----- Local variables. -------------------------------------------------------------! type(edtype) , pointer :: cgrid type(polygontype) , pointer :: cpoly diff --git a/ED/src/mpi/ed_mpass_init.F90 b/ED/src/mpi/ed_mpass_init.F90 index 2aebbf93b..ceca96909 100644 --- a/ED/src/mpi/ed_mpass_init.F90 +++ b/ED/src/mpi/ed_mpass_init.F90 @@ -28,7 +28,9 @@ subroutine ed_masterput_processid(nproc,headnode_num,masterworks,par_run) , master_num & ! intent(out) , machs ! ! intent(out) #endif - +#if defined(RAMS_MPI) + use mpi +#endif implicit none !----- Arguments. ----------------------------------------------------------------------! integer, intent(in) :: headnode_num @@ -38,7 +40,6 @@ subroutine ed_masterput_processid(nproc,headnode_num,masterworks,par_run) integer :: nm #if defined(RAMS_MPI) integer :: ierr - include 'mpif.h' !---------------------------------------------------------------------------------------! #endif @@ -359,6 +360,9 @@ subroutine ed_masterput_nl(par_run) , idetailed & ! intent(in) , patch_keep ! ! intent(in) use fusion_fission_coms , only : ifusion ! ! intent(in) +#endif +#if defined(RAMS_MPI) + use mpi #endif implicit none @@ -369,7 +373,6 @@ subroutine ed_masterput_nl(par_run) integer :: ierr integer :: n !------ Pre-compiled options. ----------------------------------------------------------! - include 'mpif.h' #endif !---------------------------------------------------------------------------------------! @@ -727,6 +730,9 @@ subroutine ed_masterput_met_header(par_run) , metvars_len ! ! intent(in) #endif +#if defined(RAMS_MPI) + use mpi +#endif implicit none !------ Arguments. ---------------------------------------------------------------------! integer , intent(in) :: par_run @@ -737,7 +743,6 @@ subroutine ed_masterput_met_header(par_run) integer :: f integer :: v !------ Pre-compiled options. ----------------------------------------------------------! - include 'mpif.h' !---------------------------------------------------------------------------------------! #endif @@ -813,6 +818,10 @@ subroutine ed_masterput_poly_dims(par_run,masterworks) , npolys_run ! ! intent(in) use mem_polygons , only : n_ed_region & ! intent(in) , n_poi ! ! intent(in) + +#if defined(RAMS_MPI) + use mpi +#endif implicit none !----- Local constants. ----------------------------------------------------------------! integer , parameter :: nmethods = 3 @@ -838,7 +847,6 @@ subroutine ed_masterput_poly_dims(par_run,masterworks) real :: totalwork #if defined(RAMS_MPI) integer :: ierr - include 'mpif.h' #endif !---------------------------------------------------------------------------------------! @@ -1122,6 +1130,9 @@ subroutine ed_masterput_worklist_info(par_run) , py_off ! ! intent(in) use mem_polygons , only : maxsite ! ! intent(in) use ed_mem_alloc , only : ed_memory_allocation ! ! subroutine +#if defined(RAMS_MPI) + use mpi +#endif implicit none !------ Arguments. ---------------------------------------------------------------------! integer , intent(in) :: par_run @@ -1139,8 +1150,6 @@ subroutine ed_masterput_worklist_info(par_run) integer :: mpiid integer , dimension(:), allocatable :: iscratch real , dimension(:), allocatable :: rscratch - !------ Pre-compiled options. ----------------------------------------------------------! - include 'mpif.h' #endif !---------------------------------------------------------------------------------------! @@ -1311,12 +1320,14 @@ subroutine ed_nodeget_processid(init) use ed_para_coms, only : nthreads ! ! intent(out) #else #endif +#if defined(RAMS_MPI) + use mpi +#endif implicit none !----- Arguments. ----------------------------------------------------------------------! integer, intent(in) :: init !----- Local variables. ----------------------------------------------------------------! #if defined(RAMS_MPI) - include 'mpif.h' integer, dimension(MPI_STATUS_SIZE) :: status #endif integer :: ierr @@ -1599,6 +1610,7 @@ subroutine ed_nodeget_nl , time2canopy & ! intent(out) , min_patch_area ! ! intent(out) use canopy_layer_coms , only : crown_mod ! ! intent(out) + use canopy_radiation_coms, only : icanrad & ! intent(out) , ihrzrad & ! intent(out) , ltrans_vis & ! intent(out) @@ -1620,9 +1632,12 @@ subroutine ed_nodeget_nl , patch_keep ! ! intent(out) use fusion_fission_coms , only : ifusion ! ! intent(out) #endif - implicit none + +#if defined(RAMS_MPI) + use mpi +#endif +implicit none #if defined(RAMS_MPI) - include 'mpif.h' !----- Local variables. ----------------------------------------------------------------! integer :: n #endif @@ -1996,9 +2011,11 @@ subroutine ed_nodeget_met_header() , met_land_mask ! ! intent(out) #endif - implicit none #if defined(RAMS_MPI) - include 'mpif.h' + use mpi +#endif + implicit none +#if defined(RAMS_MPI) !---- Local variables. -----------------------------------------------------------------! integer :: ierr integer :: nsize @@ -2084,7 +2101,10 @@ subroutine ed_nodeget_poly_dims use grid_coms , only : ngrids ! ! intent(in) #endif - implicit none +#if defined(RAMS_MPI) + use mpi +#endif +implicit none #if defined(RAMS_MPI) !----- Local variables. ----------------------------------------------------------------! @@ -2092,7 +2112,6 @@ subroutine ed_nodeget_poly_dims integer :: ifm integer :: nm !------ Pre-compiled options. ----------------------------------------------------------! - include 'mpif.h' !---------------------------------------------------------------------------------------! do ifm=1,ngrids do nm=1,nmachs @@ -2131,11 +2150,11 @@ subroutine ed_nodeget_worklist_info use ed_node_coms , only : master_num ! ! intent(in) #endif - implicit none #if defined(RAMS_MPI) - !------ Pre-compiled options. ----------------------------------------------------------! - include 'mpif.h' +!------ Pre-compiled options. ----------------------------------------------------------! +use mpi #endif +implicit none !------ Local variables. ---------------------------------------------------------------! integer :: npolygons integer :: ifm diff --git a/ED/src/utils/fatal_error.F90 b/ED/src/utils/fatal_error.F90 index 18bf18a8c..a4b45aa4d 100644 --- a/ED/src/utils/fatal_error.F90 +++ b/ED/src/utils/fatal_error.F90 @@ -8,6 +8,10 @@ subroutine fatal_error(reason,subr,file) use ed_node_coms , only : nnodetot & ! intent(in) , mynum ! ! intent(in) + +#if defined(RAMS_MPI) +use mpi_f08 +#endif implicit none !----- Arguments. ----------------------------------------------------------------------! character(len=*), intent(in) :: reason @@ -18,9 +22,7 @@ subroutine fatal_error(reason,subr,file) logical :: slavenode !---------------------------------------------------------------------------------------! -#if defined(RAMS_MPI) - include 'mpif.h' -#endif + !---------------------------------------------------------------------------------------! ! Check which type of end we should use. For the main program, this should never ! From 9ecec5248e2de2c10481003beb28653c79f89f5e Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Mon, 1 Jul 2024 13:34:53 -0400 Subject: [PATCH 10/11] Fix token comparison, the result is NULL pointer when finished not '\0' --- ED/src/utils/utils_c.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ED/src/utils/utils_c.c b/ED/src/utils/utils_c.c index 7bc79f1f3..3c5f89ced 100644 --- a/ED/src/utils/utils_c.c +++ b/ED/src/utils/utils_c.c @@ -350,7 +350,7 @@ void filelist_c_( int *inum, int *indices, char *prefix, char *chario){ token = strtok (prefix, delim); tfound=0; - while (token != '\0') { + while (token != NULL) { tfound += 1; strcpy(dir,tmpdir); @@ -381,7 +381,7 @@ void filelist_c_( int *inum, int *indices, char *prefix, char *chario){ /* Try the next token */ token = strtok(NULL,delim2); - if (token != '\0'){ + if (token != NULL){ tfound=2; strcpy(fpref2,token); } @@ -392,15 +392,15 @@ void filelist_c_( int *inum, int *indices, char *prefix, char *chario){ /* Try the first token */ - token = strtok (fpref0, delim2); - if (token != '\0'){ + token = strtok(fpref0, delim2); + if (token != NULL){ tfound=1; strcpy(fpref1,token); } /* Try the next token */ token = strtok(NULL,delim2); - if (token != '\0'){ + if (token != NULL){ tfound=2; strcpy(fpref2,token); } From dae3ac5f609f0792db873a9658ba9d02ddd82e58 Mon Sep 17 00:00:00 2001 From: caiohamamura Date: Mon, 1 Jul 2024 14:01:01 -0400 Subject: [PATCH 11/11] utils_c: use intptr_t for casting pointer to int --- ED/src/utils/utils_c.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ED/src/utils/utils_c.c b/ED/src/utils/utils_c.c index 3c5f89ced..a17d74581 100644 --- a/ED/src/utils/utils_c.c +++ b/ED/src/utils/utils_c.c @@ -8,6 +8,7 @@ */ #include "utils_sub_names.h" +#include #include #include @@ -58,16 +59,15 @@ int iralloc(int *memtot,int *ia,int *ioff) iaddr = malloc((*memtot)*sizeof(float)); -/* Compute the offset for Fortran */ - +/* Compute the offset for Fortran */ #ifdef CRAY - ifaddr = (int)ia; - imaddr = (int)iaddr; - *ioff=(imaddr-ifaddr); + ifaddr = (intptr_t)ia; + imaddr = (intptr_t)iaddr; + *ioff = (imaddr - ifaddr); #else - ifaddr = (int )ia; - imaddr = (int )iaddr; - *ioff = (imaddr-ifaddr)/sizeof(float); + ifaddr = (intptr_t)ia; + imaddr = (intptr_t)iaddr; + *ioff = (imaddr - ifaddr) / sizeof(float); #endif /* Find first empty location in address array */