Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration converter #155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,11 @@ set_SIMULATeQCD_property(maximalCenterGaugeFixing PROPERTIES RUNTIME_OUTPUT_DIRE
SIMULATeQCD_target_compile_definitions(maximalCenterGaugeFixing PRIVATE HALODEPTH_0=1 HALODEPTH_2=1 DOUBLEPREC=1 COMP_R18=1 WILSON_FLOW=1 FIXED_STEPSIZE=1)
add_to_compound_SIMULATeQCD_target(applications maximalCenterGaugeFixing)

#add_SIMULATeQCD_executable(NERSC_ILDG_Converter src/applications/main_NERSC_ILDG_Converter.cpp)
#set_SIMULATeQCD_property(NERSC_ILDG_Converter PROPERTIES RUNTIME_OUTPUT_DIRECTORY "applications")
#SIMULATeQCD_target_compile_definitions(NERSC_ILDG_Converter PRIVATE HALODEPTH_1=1 SINGLEPREC=1 DOUBLEPREC=1 COMP_R18=1 NSTACKS_1=1 LAYOUT_ALL=1)
#add_to_compound_SIMULATeQCD_target(applications NERSC_ILDG_Converter)


#-----------------------------------------------------------------------------------------COMPILATION DEFINITIONS: TOOLS

Expand Down
53 changes: 53 additions & 0 deletions src/applications/main_NERSC_ILDG_Converter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// Created by Sajid Ali on 12/21/21.
//
// converts NERSC file format to ILDG and vice versa.

#define PREC double
#define USE_GPU true

#include "../simulateqcd.h"
#include <string>
using namespace std;

int main(int argc, char *argv[]) {

stdLogger.setVerbosity(DEBUG);

LatticeParameters param;
const size_t HaloDepth = 1;
std::stringstream datNameConf;
CommunicationBase commBase(&argc, &argv);
param.readfile(commBase, "../../parameter/NERSC_ILDG_Converter.param", argc, argv);
commBase.init(param.nodeDim());

typedef GIndexer<All,HaloDepth> GInd;
initIndexer(HaloDepth,param,commBase);
Gaugefield<PREC, USE_GPU, HaloDepth> gauge_field_in(commBase);

if(param.use_unit_conf())
gauge_field_in.one();
else{
if(param.format()=="nersc")
gauge_field_in.readconf_nersc(param.GaugefileName());
else if(param.format()=="ildg")
gauge_field_in.readconf_ildg(param.GaugefileName());
else
rootLogger.error("Input configuration format is not supported");
}
gauge_field_in.updateAll();

if(param.format_out()=="nersc") {
datNameConf << param.measurements_dir()<< "conf_nersc" << param.fileExt();
gauge_field_in.writeconf_nersc(datNameConf.str(), 2, param.prec_out());
}
else if (param.format_out()=="ildg") {
datNameConf << param.measurements_dir() << "conf_ildg" << param.fileExt();
gauge_field_in.writeconf_ildg(datNameConf.str(),3,param.prec_out());
}
else
rootLogger.error("Output configurations format can only be nersc or ildg");

return 0;

}
2 changes: 2 additions & 0 deletions src/base/latticeParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class LatticeParameters : virtual public ParameterList {
Parameter<std::string> GaugefileName;
Parameter<std::string> GaugefileName_out;
Parameter<std::string> format;
Parameter<std::string> format_out;
Parameter<int> prec_out;
Parameter<bool> use_unit_conf;

Expand All @@ -49,6 +50,7 @@ class LatticeParameters : virtual public ParameterList {
addOptional(GaugefileName, "Gaugefile");
addOptional(GaugefileName_out, "Gaugefile_out");
addOptional(format, "format");
addDefault(format_out, "format_out",std::string("nersc"));
addDefault(endianness, "endianness", std::string("auto"));
addOptional(confnumber, "conf_nr");
addOptional(streamName, "stream");
Expand Down