Trying to fix linking against QMCkl.

This commit is contained in:
Francois Coppens 2021-07-21 11:48:32 +02:00
parent 8961f78ea2
commit b7764bb229
11 changed files with 83 additions and 27 deletions

View File

@ -1,6 +1,6 @@
## Compilers, compiler flags & external libs
ifeq ($(ENV),INTEL)
CXX = icpx
CXX = icpc
FC = ifort
ARCH = -march=native
OPT = -O3
@ -51,7 +51,7 @@ DEPS_F = $(DEPS_CXX) \
$(OBJ_DIR)/helpers_mod.o
## QMCkl includes and linking
QMCKL_INCLUDE = -I $(SMROOT)/qmckl/build/include/
QMCKL_INCLUDE = -I $(SMROOT)/qmckl/build/include
QMCKLLFLAGS = -L$(SMROOT)/qmckl/build/lib -lqmckl

1
libqmckl.a Symbolic link
View File

@ -0,0 +1 @@
qmckl/build/lib/libqmckl.a

1
libqmckl.la Symbolic link
View File

@ -0,0 +1 @@
qmckl/build/lib/libqmckl.la

1
libqmckl.so Symbolic link
View File

@ -0,0 +1 @@
qmckl/build/lib/libqmckl.so

1
libqmckl.so.0 Symbolic link
View File

@ -0,0 +1 @@
qmckl/build/lib/libqmckl.so.0

1
libqmckl.so.0.0.0 Symbolic link
View File

@ -0,0 +1 @@
qmckl/build/lib/libqmckl.so.0.0.0

28
main.cpp Normal file
View File

@ -0,0 +1,28 @@
#include "qmckl.h"
#include "assert.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <math.h>
#ifndef THRESHOLD
#define THRESHOLD 1e-3
#endif
int main() {
qmckl_context context;
context = qmckl_context_create();
qmckl_exit_code rc;
const uint64_t Dim = 2;
const uint64_t N_updates = 2;
const uint64_t Updates_index[2] = {0, 0};
const double Updates[4] = {0.0, 0.0, 0.0, 0.0};
double Slater_inv[4] = {0.0, 0.0, 0.0, 0.0};
rc = qmckl_sherman_morrison_c(context, Dim, N_updates, Updates, Updates_index, Slater_inv);
assert(rc == QMCKL_SUCCESS);
assert (qmckl_context_destroy(context) == QMCKL_SUCCESS);
return 0;
}

2
qmckl

@ -1 +1 @@
Subproject commit 7b2a8caeabadb7724b9d7c8b0498e7ea71b7b992
Subproject commit 04d2ec2d7098f2ac3f8e1539ab139aa35dfabe45

1
qmckl.h Symbolic link
View File

@ -0,0 +1 @@
qmckl/build/include/qmckl.h

View File

@ -27,9 +27,9 @@ export SMROOT
case $ENV in
intel)
echo "* SM build environment set to 'intel'"
export HDF5_CXX=icpx
export HDF5_CXXLINKER=icpx
export HDF5_CLINKER=icpx
export HDF5_CXX=icpc
export HDF5_CXXLINKER=icpc
export HDF5_CLINKER=icpc
export ENV=INTEL
;;
llvm)

View File

@ -1,37 +1,41 @@
#include "hdf5/serial/H5Cpp.h"
#include "hdf5/serial/hdf5.h"
#include "Helpers.hpp"
#include "qmckl.h"
#include "assert.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <math.h>
#ifndef THRESHOLD
#define THRESHOLD 1e-3
#endif
#include "cstring"
#include "iostream"
#include "Helpers.hpp"
#define PERF
#ifdef PERF
unsigned int repetition_number;
#endif
using namespace H5;
// #define DEBUG
const H5std_string FILE_NAME("dataset.hdf5");
void read_int(H5File file, std::string key, uint64_t *data) {
DataSet ds = file.openDataSet(key);
ds.read(data, PredType::STD_U32LE);
void read_int(H5::H5File file, std::string key, uint64_t *data) {
H5::DataSet ds = file.openDataSet(key);
ds.read(data, H5::PredType::STD_U32LE);
ds.close();
}
void read_double(H5File file, std::string key, double *data) {
DataSet ds = file.openDataSet(key);
ds.read(data, PredType::IEEE_F64LE);
void read_double(H5::H5File file, std::string key, double *data) {
H5::DataSet ds = file.openDataSet(key);
ds.read(data, H5::PredType::IEEE_F64LE);
ds.close();
}
int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
int test_cycle(H5::H5File file, int cycle, std::string version, double tolerance) {
/* Read the data */
@ -76,14 +80,32 @@ int test_cycle(H5File file, int cycle, std::string version, double tolerance) {
for (unsigned int i = 0; i < repetition_number; i++) {
memcpy(slater_inverse_nonpersistent, slater_inverse,
dim * dim * sizeof(double));
qmckl_exit_code sherman_morrison_exit;
qmckl_context context;
sherman_morrison_exit = qmckl_sherman_morrison_c(context,
dim,
nupdates,
u,
col_update_index,
slater_inverse_nonpersistent);
context = qmckl_context_create();
qmckl_exit_code rc;
// const uint64_t cdim = dim;
// const uint64_t cnupdates = nupdates;
// const uint64_t* ccol_update_index = col_update_index;
// const double* cu = u;
// rc = qmckl_sherman_morrison_c(
// context,
// cdim,
// cnupdates,
// cu,
// ccol_update_index,
// slater_inverse_nonpersistent);
const uint64_t Dim = 2;
const uint64_t N_updates = 2;
const uint64_t Updates_index[2] = {0, 0};
const double Updates[4] = {0.0, 0.0, 0.0, 0.0};
double Slater_inv[4] = {0.0, 0.0, 0.0, 0.0};
rc = qmckl_sherman_morrison_c(context,
Dim,
N_updates,
Updates,
Updates_index,
Slater_inv);
assert(rc == QMCKL_SUCCESS);
}
}
else {
@ -148,7 +170,7 @@ int main(int argc, char **argv) {
int start_cycle = std::stoi(argv[2]);
int stop_cycle = std::stoi(argv[3]);
double tolerance = std::stod(argv[4]);
H5File file(FILE_NAME, H5F_ACC_RDONLY);
H5::H5File file(FILE_NAME, H5F_ACC_RDONLY);
#ifdef PERF
repetition_number = std::stoi(argv[5]);