Skip to content

Commit

Permalink
Merge branch 'release/v0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
paboyle committed May 12, 2017
2 parents 51bf150 + 7a8f6af commit c4435e6
Show file tree
Hide file tree
Showing 21 changed files with 465 additions and 52 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -24,7 +24,7 @@ _Please do not send pull requests to the `master` branch which is reserved for r

### Compilers

Intel ICPC v16 and later
Intel ICPC v16.0.3 and later

Clang v3.5 and later (need 3.8 and later for OpenMP)

Expand Down Expand Up @@ -52,7 +52,7 @@ When you file an issue, please go though the following checklist:
2. Give a description of the target platform (CPU, network, compiler). Please give the full CPU part description, using for example `cat /proc/cpuinfo | grep 'model name' | uniq` (Linux) or `sysctl machdep.cpu.brand_string` (macOS) and the full output the `--version` option of your compiler.
3. Give the exact `configure` command used.
4. Attach `config.log`.
5. Attach `config.summary`.
5. Attach `grid.config.summary`.
6. Attach the output of `make V=1`.
7. Describe the issue and any previous attempt to solve it. If relevant, show how to reproduce the issue using a minimal working example.

Expand Down
2 changes: 1 addition & 1 deletion bootstrap.sh
@@ -1,6 +1,6 @@
]#!/usr/bin/env bash

EIGEN_URL='http://bitbucket.org/eigen/eigen/get/3.2.9.tar.bz2'
EIGEN_URL='http://bitbucket.org/eigen/eigen/get/3.3.3.tar.bz2'

echo "-- deploying Eigen source..."
wget ${EIGEN_URL} --no-check-certificate
Expand Down
5 changes: 3 additions & 2 deletions configure.ac
@@ -1,9 +1,9 @@
AC_PREREQ([2.63])
AC_INIT([Grid], [0.6.0-dev], [https://github.com/paboyle/Grid], [Grid])
AC_INIT([Grid], [0.7.0], [https://github.com/paboyle/Grid], [Grid])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(subdir-objects)
AM_INIT_AUTOMAKE([subdir-objects 1.13])
AM_EXTRA_RECURSIVE_TARGETS([tests bench])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([lib/Grid.h])
Expand All @@ -29,6 +29,7 @@ AC_DEFINE_UNQUOTED([GXX_VERSION],["$GXX_VERSION"],

CXXFLAGS="-O3 $CXXFLAGS"


############### Checks for typedefs, structures, and compiler characteristics
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
Expand Down
2 changes: 1 addition & 1 deletion lib/json/json.hpp
Expand Up @@ -28,7 +28,7 @@ SOFTWARE.

#ifndef NLOHMANN_JSON_HPP
#define NLOHMANN_JSON_HPP

#include <Grid/DisableWarnings.h>
#include <algorithm> // all_of, for_each, transform
#include <array> // array
#include <cassert> // assert
Expand Down
1 change: 1 addition & 0 deletions lib/log/Log.cc
Expand Up @@ -30,6 +30,7 @@ directory
*************************************************************************************/
/* END LEGAL */
#include <Grid/GridCore.h>
#include <Grid/util/CompilerCompatible.h>

#include <cxxabi.h>
#include <memory>
Expand Down
30 changes: 21 additions & 9 deletions lib/qcd/action/fermion/FermionOperatorImpl.h
Expand Up @@ -220,20 +220,32 @@ namespace QCD {

inline void DoubleStore(GridBase *GaugeGrid,
DoubledGaugeField &Uds,
const GaugeField &Umu) {
const GaugeField &Umu)
{
typedef typename Simd::scalar_type scalar_type;

conformable(Uds._grid, GaugeGrid);
conformable(Umu._grid, GaugeGrid);

GaugeLinkField U(GaugeGrid);
GaugeLinkField tmp(GaugeGrid);

Lattice<iScalar<vInteger> > coor(GaugeGrid);
for (int mu = 0; mu < Nd; mu++) {
LatticeCoordinate(coor, mu);

auto pha = Params.boundary_phases[mu];
scalar_type phase( real(pha),imag(pha) );

int Lmu = GaugeGrid->GlobalDimensions()[mu] - 1;

LatticeCoordinate(coor, mu);

U = PeekIndex<LorentzIndex>(Umu, mu);
tmp = where(coor == Lmu, Params.boundary_phases[mu] * U, U);
tmp = where(coor == Lmu, phase * U, U);
PokeIndex<LorentzIndex>(Uds, tmp, mu);

U = adj(Cshift(U, mu, -1));
U = where(coor == 0, Params.boundary_phases[mu] * U, U);
U = where(coor == 0, conjugate(phase) * U, U);
PokeIndex<LorentzIndex>(Uds, U, mu + 4);
}
}
Expand All @@ -251,11 +263,11 @@ namespace QCD {
tmp = zero;

parallel_for(int sss=0;sss<tmp._grid->oSites();sss++){
int sU=sss;
for(int s=0;s<Ls;s++){
int sF = s+Ls*sU;
tmp[sU] = tmp[sU]+ traceIndex<SpinIndex>(outerProduct(Btilde[sF],Atilde[sF])); // ordering here
}
int sU=sss;
for(int s=0;s<Ls;s++){
int sF = s+Ls*sU;
tmp[sU] = tmp[sU]+ traceIndex<SpinIndex>(outerProduct(Btilde[sF],Atilde[sF])); // ordering here
}
}
PokeIndex<LorentzIndex>(mat,tmp,mu);

Expand Down
13 changes: 6 additions & 7 deletions lib/serialisation/JSON_IO.cc
Expand Up @@ -40,7 +40,6 @@ JSONWriter::~JSONWriter(void)
delete_comma();
ss_ << "}";

cout << ss_.str() << endl;
// write prettified JSON to file
std::ofstream os(fileName_);
os << std::setw(2) << json::parse(ss_.str()) << std::endl;
Expand Down Expand Up @@ -95,7 +94,7 @@ JSONReader::JSONReader(const string &fileName)

// test
// serialize to standard output
std::cout << "JSONReader::JSONReader : " << jobject_ << endl;
//std::cout << "JSONReader::JSONReader : " << jobject_ << endl;
jcur_ = jobject_;
}

Expand All @@ -113,7 +112,7 @@ bool JSONReader::push(const string &s)
std::cout << "out of range: " << e.what() << '\n';
return false;
}
cout << "JSONReader::push : " << s << " : "<< jcur_ << endl;
//cout << "JSONReader::push : " << s << " : "<< jcur_ << endl;
}
else
{
Expand All @@ -134,7 +133,7 @@ void JSONReader::pop(void)
else
do_pop.pop_back();

cout << "JSONReader::pop : " << jcur_ << endl;
//cout << "JSONReader::pop : " << jcur_ << endl;
}

bool JSONReader::nextElement(const std::string &s)
Expand All @@ -157,14 +156,14 @@ bool JSONReader::nextElement(const std::string &s)
template <>
void JSONReader::readDefault(const string &s, string &output)
{
cout << "JSONReader::readDefault(string) : " << s<< " " << jcur_ << endl;
//cout << "JSONReader::readDefault(string) : " << s<< " " << jcur_ << endl;
if (s.size()){
std::cout << "String: "<< jcur_[s] << std::endl;
//std::cout << "String: "<< jcur_[s] << std::endl;
output = jcur_[s];
}
else
{
std::cout << "String: "<< jcur_ << std::endl;
//std::cout << "String: "<< jcur_ << std::endl;
output = jcur_;
}
}
75 changes: 56 additions & 19 deletions lib/serialisation/JSON_IO.h
@@ -1,6 +1,6 @@
/*************************************************************************************
Grid physics library, www.github.com/paboyle/Grid
Grid physics library, www.github.com/paboyle/Grid
Source file: ./lib/serialisation/JSON_IO.h
Expand Down Expand Up @@ -43,10 +43,10 @@ using json = nlohmann::json;

namespace Grid
{

class JSONWriter: public Writer<JSONWriter>
{

public:
JSONWriter(const std::string &fileName);
virtual ~JSONWriter(void);
Expand All @@ -55,6 +55,8 @@ namespace Grid
template <typename U>
void writeDefault(const std::string &s, const U &x);
template <typename U>
void writeDefault(const std::string &s, const std::complex<U> &x);
template <typename U>
void writeDefault(const std::string &s, const std::vector<U> &x);

template<std::size_t N>
Expand All @@ -65,7 +67,7 @@ namespace Grid
std::string fileName_;
std::ostringstream ss_;
};

class JSONReader: public Reader<JSONReader>
{
public:
Expand All @@ -77,6 +79,8 @@ namespace Grid
template <typename U>
void readDefault(const std::string &s, U &output);
template <typename U>
void readDefault(const std::string &s, std::complex<U> &output);
template <typename U>
void readDefault(const std::string &s, std::vector<U> &output);
private:
json jobject_; // main object
Expand All @@ -97,11 +101,12 @@ namespace Grid
struct isWriter< JSONWriter > {
static const bool value = true;
};

// Writer template implementation ////////////////////////////////////////////
template <typename U>
void JSONWriter::writeDefault(const std::string &s, const U &x)
{
//std::cout << "JSONReader::writeDefault(U) : " << s << std::endl;
std::ostringstream os;
os << std::boolalpha << x;
if (s.size())
Expand All @@ -110,9 +115,23 @@ namespace Grid
ss_ << os.str() << " ," ;
}

template <typename U>
void JSONWriter::writeDefault(const std::string &s, const std::complex<U> &x)
{
//std::cout << "JSONReader::writeDefault(complex) : " << s << std::endl;
std::ostringstream os;
os << "["<< std::boolalpha << x.real() << ", " << x.imag() << "]";
if (s.size())
ss_ << "\""<< s << "\" : " << os.str() << " ," ;
else
ss_ << os.str() << " ," ;
}

template <typename U>
void JSONWriter::writeDefault(const std::string &s, const std::vector<U> &x)
{
//std::cout << "JSONReader::writeDefault(vec U) : " << s << std::endl;

if (s.size())
ss_ << " \""<<s<<"\" : [";
else
Expand All @@ -124,59 +143,77 @@ namespace Grid
delete_comma();
ss_<< "],";
}

template<std::size_t N>
void JSONWriter::writeDefault(const std::string &s, const char(&x)[N]){
//std::cout << "JSONReader::writeDefault(char U) : " << s << std::endl;

if (s.size())
ss_ << "\""<< s << "\" : \"" << x << "\" ," ;
else
ss_ << "\"" << x << "\" ," ;
ss_ << "\"" << x << "\" ," ;
}

// Reader template implementation ////////////////////////////////////////////
template <typename U>
void JSONReader::readDefault(const std::string &s, U &output)
{
std::cout << "JSONReader::readDefault(U) : " << s << " : "<< jcur_ << std::endl;
//std::cout << "JSONReader::readDefault(U) : " << s << " : "<< jcur_ << std::endl;

if (s.size()){
std::cout << "String: "<< jcur_[s] << std::endl;
//std::cout << "String: "<< jcur_[s] << std::endl;
output = jcur_[s];
}
else
{
std::cout << "String: "<< jcur_ << std::endl;
output = jcur_;
//std::cout << "String: "<< jcur_ << std::endl;
output = jcur_;
}


}


template <typename U>
void JSONReader::readDefault(const std::string &s, std::complex<U> &output)
{
U tmp1, tmp2;
//std::cout << "JSONReader::readDefault( complex U) : " << s << " : "<< jcur_ << std::endl;
json j = jcur_;
json::iterator it = j.begin();
jcur_ = *it;
read("", tmp1);
it++;
jcur_ = *it;
read("", tmp2);
output = std::complex<U>(tmp1,tmp2);
}


template <>
void JSONReader::readDefault(const std::string &s, std::string &output);

template <typename U>
void JSONReader::readDefault(const std::string &s, std::vector<U> &output)
{
std::string buf;
unsigned int i = 0;
std::cout << "JSONReader::readDefault(vec) : " << jcur_ << std::endl;
//std::cout << "JSONReader::readDefault(vec) : " << jcur_ << std::endl;
if (s.size())
push(s);

json j = jcur_;
for (json::iterator it = j.begin(); it != j.end(); ++it) {
jcur_ = *it;
std::cout << "Value: " << it.value() << "\n";
//std::cout << "Value: " << it.value() << "\n";
output.resize(i + 1);
read("", output[i++]);
}


jcur_ = j;
if (s.size())
pop();
}

}
#endif

0 comments on commit c4435e6

Please sign in to comment.