mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-09 13:40:46 +01:00
Making the ILDG support optional
This commit is contained in:
parent
47c7159177
commit
d50055cd96
@ -131,9 +131,11 @@ CXXFLAGS=$CXXFLAGS_CPY
|
|||||||
LDFLAGS=$LDFLAGS_CPY
|
LDFLAGS=$LDFLAGS_CPY
|
||||||
|
|
||||||
AC_CHECK_LIB([lime],[limeCreateReader],
|
AC_CHECK_LIB([lime],[limeCreateReader],
|
||||||
|
[AC_DEFINE([HAVE_LIME],[1],[Define to 1 if you have the `LIME' library (-llime).])]
|
||||||
|
[have_lime=true]
|
||||||
[LIBS="$LIBS -llime"],
|
[LIBS="$LIBS -llime"],
|
||||||
[AC_MSG_ERROR(C-LIME library was not found in your system.
|
[AC_MSG_WARN(C-LIME library was not found in your system.
|
||||||
Please install or provide the correct path to your installation [default search path ~/lime/]
|
In order to use ILGG file format please install or provide the correct path to your installation [default search path ~/lime/]
|
||||||
Info at: http://usqcd.jlab.org/usqcd-docs/c-lime/)])
|
Info at: http://usqcd.jlab.org/usqcd-docs/c-lime/)])
|
||||||
|
|
||||||
|
|
||||||
@ -355,6 +357,7 @@ Summary of configuration for $PACKAGE v$VERSION
|
|||||||
- RNG choice : ${ac_RNG}
|
- RNG choice : ${ac_RNG}
|
||||||
- GMP : `if test "x$have_gmp" = xtrue; then echo yes; else echo no; fi`
|
- GMP : `if test "x$have_gmp" = xtrue; then echo yes; else echo no; fi`
|
||||||
- LAPACK : ${ac_LAPACK}
|
- LAPACK : ${ac_LAPACK}
|
||||||
|
- ILDG support (LIME) : `if test "x$have_lime" = xtrue; then echo yes; else echo no; fi`
|
||||||
- FFTW : `if test "x$have_fftw" = xtrue; then echo yes; else echo no; fi`
|
- FFTW : `if test "x$have_fftw" = xtrue; then echo yes; else echo no; fi`
|
||||||
- build DOXYGEN documentation : `if test "x$enable_doc" = xyes; then echo yes; else echo no; fi`
|
- build DOXYGEN documentation : `if test "x$enable_doc" = xyes; then echo yes; else echo no; fi`
|
||||||
- graphs and diagrams : `if test "x$enable_dot" = xyes; then echo yes; else echo no; fi`
|
- graphs and diagrams : `if test "x$enable_dot" = xyes; then echo yes; else echo no; fi`
|
||||||
|
@ -568,9 +568,11 @@ class BinaryIO {
|
|||||||
|
|
||||||
if (ILDG.is_ILDG){
|
if (ILDG.is_ILDG){
|
||||||
// use C-LIME to populate the record
|
// use C-LIME to populate the record
|
||||||
|
#ifdef HAVE_LIME
|
||||||
size_t sizeFO = sizeof(fileObj);
|
size_t sizeFO = sizeof(fileObj);
|
||||||
limeReaderSeek(ILDG.LR, g_idx*sizeFO, SEEK_SET);
|
limeReaderSeek(ILDG.LR, g_idx*sizeFO, SEEK_SET);
|
||||||
int status = limeReaderReadData((void *)&fileObj, &sizeFO, ILDG.LR);
|
int status = limeReaderReadData((void *)&fileObj, &sizeFO, ILDG.LR);
|
||||||
|
#endif
|
||||||
} else{
|
} else{
|
||||||
fin.seekg(offset+g_idx*sizeof(fileObj));
|
fin.seekg(offset+g_idx*sizeof(fileObj));
|
||||||
fin.read((char *)&fileObj,sizeof(fileObj));
|
fin.read((char *)&fileObj,sizeof(fileObj));
|
||||||
@ -764,11 +766,16 @@ class BinaryIO {
|
|||||||
if (ieee64big) htobe64_v((void *)&fileObj, sizeof(fileObj));
|
if (ieee64big) htobe64_v((void *)&fileObj, sizeof(fileObj));
|
||||||
if (ieee64) htole64_v((void *)&fileObj, sizeof(fileObj));
|
if (ieee64) htole64_v((void *)&fileObj, sizeof(fileObj));
|
||||||
|
|
||||||
|
|
||||||
if (ILDG.is_ILDG) {
|
if (ILDG.is_ILDG) {
|
||||||
|
#ifdef HAVE_LIME
|
||||||
size_t sizeFO = sizeof(fileObj);
|
size_t sizeFO = sizeof(fileObj);
|
||||||
limeWriterSeek(ILDG.LW, g_idx*sizeFO, SEEK_SET);
|
limeWriterSeek(ILDG.LW, g_idx*sizeFO, SEEK_SET);
|
||||||
int status = limeWriteRecordData((void *)&fileObj, &sizeFO, ILDG.LW);
|
int status = limeWriteRecordData((void *)&fileObj, &sizeFO, ILDG.LW);
|
||||||
} else {
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
fout.seekp(offset + g_idx * sizeof(fileObj));
|
fout.seekp(offset + g_idx * sizeof(fileObj));
|
||||||
fout.write((char *)&fileObj, sizeof(fileObj));
|
fout.write((char *)&fileObj, sizeof(fileObj));
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,8 @@ directory
|
|||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_LIME
|
||||||
|
|
||||||
extern "C" { // for linkage
|
extern "C" { // for linkage
|
||||||
#include "lime.h"
|
#include "lime.h"
|
||||||
}
|
}
|
||||||
@ -238,8 +240,12 @@ class ILDGIO : public BinaryIO {
|
|||||||
return csum;
|
return csum;
|
||||||
}
|
}
|
||||||
|
|
||||||
// format for RNG?
|
// format for RNG? Now just binary out
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//HAVE_LIME
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,50 +27,54 @@ directory
|
|||||||
#ifndef GRID_ILDGTYPES_IO_H
|
#ifndef GRID_ILDGTYPES_IO_H
|
||||||
#define GRID_ILDGTYPES_IO_H
|
#define GRID_ILDGTYPES_IO_H
|
||||||
|
|
||||||
|
#ifdef HAVE_LIME
|
||||||
extern "C" { // for linkage
|
extern "C" { // for linkage
|
||||||
#include "lime.h"
|
#include "lime.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Grid {
|
namespace Grid {
|
||||||
|
|
||||||
struct ILDGtype{
|
struct ILDGtype {
|
||||||
bool is_ILDG;
|
bool is_ILDG;
|
||||||
LimeWriter* LW;
|
LimeWriter* LW;
|
||||||
LimeReader* LR;
|
LimeReader* LR;
|
||||||
|
|
||||||
ILDGtype(bool is, LimeWriter* L):is_ILDG(is),LW(L),LR(NULL){}
|
|
||||||
ILDGtype(bool is, LimeReader* L):is_ILDG(is),LW(NULL),LR(L){}
|
|
||||||
ILDGtype():is_ILDG(false),LW(NULL),LR(NULL){}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ILDGField {
|
|
||||||
public:
|
|
||||||
// header strings (not in order)
|
|
||||||
std::vector<int> dimension;
|
|
||||||
std::vector<std::string> boundary;
|
|
||||||
int data_start;
|
|
||||||
std::string hdr_version;
|
|
||||||
std::string storage_format;
|
|
||||||
// Checks on data
|
|
||||||
double link_trace;
|
|
||||||
double plaquette;
|
|
||||||
uint32_t checksum;
|
|
||||||
unsigned int sequence_number;
|
|
||||||
std::string data_type;
|
|
||||||
std::string ensemble_id ;
|
|
||||||
std::string ensemble_label ;
|
|
||||||
std::string creator ;
|
|
||||||
std::string creator_hardware ;
|
|
||||||
std::string creation_date ;
|
|
||||||
std::string archive_date ;
|
|
||||||
std::string floating_point;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ILDGtype(bool is, LimeWriter* L) : is_ILDG(is), LW(L), LR(NULL) {}
|
||||||
|
ILDGtype(bool is, LimeReader* L) : is_ILDG(is), LW(NULL), LR(L) {}
|
||||||
|
ILDGtype() : is_ILDG(false), LW(NULL), LR(NULL) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class ILDGField {
|
||||||
|
public:
|
||||||
|
// header strings (not in order)
|
||||||
|
std::vector<int> dimension;
|
||||||
|
std::vector<std::string> boundary;
|
||||||
|
int data_start;
|
||||||
|
std::string hdr_version;
|
||||||
|
std::string storage_format;
|
||||||
|
// Checks on data
|
||||||
|
double link_trace;
|
||||||
|
double plaquette;
|
||||||
|
uint32_t checksum;
|
||||||
|
unsigned int sequence_number;
|
||||||
|
std::string data_type;
|
||||||
|
std::string ensemble_id;
|
||||||
|
std::string ensemble_label;
|
||||||
|
std::string creator;
|
||||||
|
std::string creator_hardware;
|
||||||
|
std::string creation_date;
|
||||||
|
std::string archive_date;
|
||||||
|
std::string floating_point;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
namespace Grid {
|
||||||
|
|
||||||
|
struct ILDGtype {
|
||||||
|
bool is_ILDG;
|
||||||
|
ILDGtype() : is_ILDG(false) {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,6 +83,7 @@ namespace QCD {
|
|||||||
}
|
}
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
template <class SmearingPolicy, class IOCheckpointer>
|
template <class SmearingPolicy, class IOCheckpointer>
|
||||||
void Runner(int argc,
|
void Runner(int argc,
|
||||||
char ** argv,
|
char ** argv,
|
||||||
|
@ -29,6 +29,8 @@ directory
|
|||||||
#ifndef ILDG_CHECKPOINTER
|
#ifndef ILDG_CHECKPOINTER
|
||||||
#define ILDG_CHECKPOINTER
|
#define ILDG_CHECKPOINTER
|
||||||
|
|
||||||
|
#ifdef HAVE_LIME
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -47,7 +49,7 @@ class ILDGHmcCheckpointer
|
|||||||
std::string format;
|
std::string format;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
INHERIT_GIMPL_TYPES(Implementation); //
|
INHERIT_GIMPL_TYPES(Implementation);
|
||||||
|
|
||||||
ILDGHmcCheckpointer(std::string cf, std::string rn, int savemodulo,
|
ILDGHmcCheckpointer(std::string cf, std::string rn, int savemodulo,
|
||||||
std::string form = "IEEE64BIG") {
|
std::string form = "IEEE64BIG") {
|
||||||
@ -62,8 +64,13 @@ class ILDGHmcCheckpointer
|
|||||||
int ieee64big = (format == std::string("IEEE64BIG"));
|
int ieee64big = (format == std::string("IEEE64BIG"));
|
||||||
int ieee64 = (format == std::string("IEEE64"));
|
int ieee64 = (format == std::string("IEEE64"));
|
||||||
|
|
||||||
if (!(ieee64big ^ ieee32 ^ ieee32big ^ ieee64)) {
|
if (!(ieee64big || ieee32 || ieee32big || ieee64)) {
|
||||||
std::cout << GridLogMessage << "Invalid format: " << format << std::endl;
|
std::cout << GridLogError << "Unrecognized file format " << format
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << GridLogError
|
||||||
|
<< "Allowed: IEEE32BIG | IEEE32 | IEEE64BIG | IEEE64"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -118,4 +125,6 @@ class ILDGHmcCheckpointer
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -81,6 +81,10 @@ class HmcRunner : public BinaryHmcRunner {
|
|||||||
TheAction.push_back(Level1);
|
TheAction.push_back(Level1);
|
||||||
|
|
||||||
// Add observables
|
// Add observables
|
||||||
|
// options for checkpointers
|
||||||
|
//BinaryHmcCheckpointer
|
||||||
|
//ILDGHmcCheckpointer
|
||||||
|
//NerscHmcCheckpointer
|
||||||
ILDGHmcCheckpointer<BinaryHmcRunner::ImplPolicy> Checkpoint(
|
ILDGHmcCheckpointer<BinaryHmcRunner::ImplPolicy> Checkpoint(
|
||||||
HMCPar.conf_prefix, HMCPar.rng_prefix, HMCPar.SaveInterval, HMCPar.format);
|
HMCPar.conf_prefix, HMCPar.rng_prefix, HMCPar.SaveInterval, HMCPar.format);
|
||||||
// Can implement also a specific function in the hmcrunner
|
// Can implement also a specific function in the hmcrunner
|
||||||
|
Loading…
x
Reference in New Issue
Block a user