Skip to content

Commit

Permalink
Merge pull request #16711 from lexming/20221123103450_new_pr_Block153…
Browse files Browse the repository at this point in the history
…20210723

{phys}[foss/2022a] Block v1.5.3-20200525
  • Loading branch information
boegel authored Jan 20, 2023
2 parents c95857f + d14524f commit d6aeaaf
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 0 deletions.
53 changes: 53 additions & 0 deletions easybuild/easyconfigs/b/Block/Block-1.5.3-20200525-foss-2022a.eb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
easyblock = 'MakeCp'

name = 'Block'
version = '1.5.3-20200525'
_commit = 'f95317b08043b7c531289576d59ad74a6d920741'

homepage = 'https://sanshar.github.io/Block/'
description = """Block implements the density matrix renormalization group (DMRG) algorithm for
quantum chemistry."""

toolchain = {'name': 'foss', 'version': '2022a'}
toolchainopts = {'cstd': 'c++11', 'pic': True}

# Version 1.5 is a major rewrite of Block that was named at some point StackBlock
# sources are available in sanshar/StackBlock
# sources at sanshar/Block@b0e3671aad and pyscf/Block@db27636b76 correspond to version 1.1.1
source_urls = ['https://github.com/sanshar/StackBlock/archive']
sources = [{'download_filename': '%s.tar.gz' % _commit, 'filename': '%(version)s.tar.gz'}]
patches = [
'Block-1.5.3_use-eb-environment.patch',
'Block-1.5.3_replace_mpi_cxx_binds_with_boost_mpi.patch',
]
checksums = [
{'1.5.3-20200525.tar.gz': '8d793c5e460d7747a0adcb06ce4b457c6750cf2d42cead1d060db8b44643c3b1'},
{'Block-1.5.3_use-eb-environment.patch': '7f3e8a52f28d251441d20dfde1f9cb8cdc0c34216defab61cc6980e540a6cf60'},
{'Block-1.5.3_replace_mpi_cxx_binds_with_boost_mpi.patch':
'f53f1f88cb7b12ab38d1313f93a9bbd31c745dca1beca7a8d51d00e0ae4e762f'},
]

dependencies = [
('Boost.MPI', '1.79.0'),
]

buildopts = [
# Multi-threaded build (block.spin_adapted-serial)
'OPENMP="yes" EXECUTABLE="block.spin_adapted-serial"',
# MPI build (block.spin_adapted)
'USE_MPI="yes"',
]

files_to_copy = [(['block.spin_adapted*'], 'bin')]

sanity_check_paths = {
'files': ['bin/block.spin_adapted', 'bin/block.spin_adapted-serial'],
'dirs': [],
}

sanity_check_commands = [
"block.spin_adapted-serial --version",
"%(mpi_cmd_prefix)s block.spin_adapted --version",
]

moduleclass = 'phys'
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
From ced3681cd8c4fe5e10f84d23973ed0e5ee4e0098 Mon Sep 17 00:00:00 2001
From: Matthias Degroote <[email protected]>
Date: Sat, 13 Mar 2021 15:49:28 +0100
Subject: [PATCH] Remove old c++ MPI bindings

--- input.C.orig 2023-01-07 01:14:17.074836000 +0100
+++ input.C 2023-01-17 14:22:56.060651139 +0100
@@ -24,7 +24,6 @@
#include <boost/algorithm/string.hpp>
#ifndef SERIAL
#include <boost/mpi.hpp>
-#include "mpi.h"
#endif
#include <boost/filesystem.hpp>
#include "fiedler.h"
@@ -1862,7 +1861,7 @@
}
#ifndef SERIAL
//wait for all procs to zero out the memory
- MPI::COMM_WORLD.Barrier();
+ world.barrier();
#endif
v1.set_data() = static_cast<double*>(region.get_address()) + (oneIntegralMem+twoIntegralMem)*integralIndex;
v2.set_data() = static_cast<double*>(region.get_address()) + oneIntegralMem + (oneIntegralMem+twoIntegralMem)*integralIndex;
@@ -1930,16 +1929,16 @@
}

#ifndef SERIAL
- MPI::COMM_WORLD.Barrier();
+ world.barrier();
long intdim = oneIntegralMem+twoIntegralMem;
long maxint = 26843540; //mpi cannot transfer more than these number of doubles
long maxIter = intdim/maxint;
for (int i=0; i<maxIter; i++) {
- MPI::COMM_WORLD.Bcast(v1.set_data()+i*maxint, maxint, MPI_DOUBLE, 0);
- MPI::COMM_WORLD.Barrier();
+ mpi::broadcast(world, v1.set_data()+i*maxint, maxint, 0);
+ world.barrier();
}
- MPI::COMM_WORLD.Bcast(v1.set_data()+(maxIter)*maxint, oneIntegralMem+twoIntegralMem - maxIter*maxint, MPI_DOUBLE, 0);
- MPI::COMM_WORLD.Barrier();
+ mpi::broadcast(world, v1.set_data()+(maxIter)*maxint, oneIntegralMem+twoIntegralMem - maxIter*maxint, 0);
+ world.barrier();

#endif
}
@@ -2197,7 +2196,7 @@
}
#ifndef SERIAL
//wait for all procs to zero out the memory
- MPI::COMM_WORLD.Barrier();
+ world.barrier();
#endif
v1.set_data() = static_cast<double*>(region.get_address()) + intdim*integralIndex;
vcc.set_data() = static_cast<double*>(region.get_address()) + oneIntegralMem + intdim*integralIndex;
@@ -2302,15 +2301,15 @@
dumpFile.close();
}
#ifndef SERIAL
- MPI::COMM_WORLD.Barrier();
+ world.barrier();
long maxint = 26843540; //mpi cannot transfer more than these number of doubles
long maxIter = intdim/maxint;
for (int i=0; i<maxIter; i++) {
- MPI::COMM_WORLD.Bcast(v1.set_data()+i*maxint, maxint, MPI_DOUBLE, 0);
- MPI::COMM_WORLD.Barrier();
+ mpi::broadcast(world, v1.set_data()+i*maxint, maxint, 0);
+ world.barrier();
}
- MPI::COMM_WORLD.Bcast(v1.set_data()+(maxIter)*maxint, intdim - maxIter*maxint, MPI_DOUBLE, 0);
- MPI::COMM_WORLD.Barrier();
+ mpi::broadcast(world, v1.set_data()+(maxIter)*maxint, intdim - maxIter*maxint, 0);
+ world.barrier();

#endif
}
@@ -2577,7 +2576,7 @@
region = boost::interprocess::mapped_region{segment, boost::interprocess::read_write};
memset(region.get_address(), 0., (oneIntegralMem+twoIntegralMem+PerturboneIntegralMem)*m_num_Integrals*sizeof(double));
//wait for all procs to zero out the memory
- MPI::COMM_WORLD.Barrier();
+ world.barrier();
v1.set_data() = static_cast<double*>(region.get_address());
v2.set_data() = static_cast<double*>(region.get_address()) + oneIntegralMem;
vpt1.set_data() = static_cast<double*>(region.get_address()) + oneIntegralMem + twoIntegralMem;
@@ -2692,16 +2691,16 @@
dumpFile.close();
}
#ifndef SERIAL
- MPI::COMM_WORLD.Barrier();
+ world.barrier();
long intdim = oneIntegralMem+twoIntegralMem+PerturboneIntegralMem;
long maxint = 26843540; //mpi cannot transfer more than these number of doubles
long maxIter = intdim/maxint;
for (int i=0; i<maxIter; i++) {
- MPI::COMM_WORLD.Bcast(v1.set_data()+i*maxint, maxint, MPI_DOUBLE, 0);
- MPI::COMM_WORLD.Barrier();
+ mpi::broadcast(world, v1.set_data()+i*maxint, maxint, 0);
+ world.barrier();
}
- MPI::COMM_WORLD.Bcast(v1.set_data()+(maxIter)*maxint, oneIntegralMem+twoIntegralMem+PerturboneIntegralMem- maxIter*maxint, MPI_DOUBLE, 0);
- MPI::COMM_WORLD.Barrier();
+ mpi::broadcast(world, v1.set_data()+(maxIter)*maxint, oneIntegralMem+twoIntegralMem+PerturboneIntegralMem- maxIter*maxint, 0);
+ world.barrier();

#endif
}
71 changes: 71 additions & 0 deletions easybuild/easyconfigs/b/Block/Block-1.5.3_use-eb-environment.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Use build environment defined by EasyBuild
author: Nicholas Cheng (@nicholascheng94)
author: Alex Domingo (Vrije Universiteit Brussel)
--- Makefile.orig 2023-01-06 12:46:33.569558000 +0100
+++ Makefile 2023-01-06 15:47:17.535047461 +0100
@@ -8,16 +8,16 @@
# change to icpc for Intel
#CXX = clang++
#MPICXX = mpiicpc
-CXX = g++
-MPICXX = mpic++
-export CXX
-export MPICXX
+#CXX = g++
+#MPICXX = mpic++
+#export CXX
+#export MPICXX

# BOOST include directory
#BOOSTDIR=/software/StackBlock/boost_1_58_0
#BOOSTINCLUDE = ${BOOSTDIR}/include
-BOOSTDIR=/usr/lib
-BOOSTINCLUDE =/usr/include
+BOOSTDIR = $(EBROOTBOOST)
+BOOSTINCLUDE = ${BOOSTDIR}/include

# set to yes if using BOOST version >= 1.56.0
USE_BOOST56 = yes
@@ -35,7 +35,7 @@

#LAPACKBLAS = -lblas -llapack
#LAPACKBLAS = /usr/lib/liblapack.dylib /usr/lib/libblas.dylib
-LAPACKBLAS =
+LAPACKBLAS = ${LIBBLAS}

# set if we will use MPI or OpenMP
USE_MPI = no
@@ -108,12 +108,12 @@
MOLCAS_BLOCK= -DMOLCAS -fPIC
endif

-FLAGS = -I${MKLFLAGS} -I$(INCLUDE1) -I$(INCLUDE2) -I$(NEWMATINCLUDE) -I$(BOOSTINCLUDE) -I$(MOLPROINCLUDE) \
+FLAGS = $(CPPFLAGS) -I${MKLFLAGS} -I$(INCLUDE1) -I$(INCLUDE2) -I$(NEWMATINCLUDE) -I$(BOOSTINCLUDE) -I$(MOLPROINCLUDE) \
-I$(HOME)/modules/generate_blocks/ -I$(HOME)/modules/onepdm -I$(HOME)/modules/twopdm/ \
-I$(HOME)/modules/npdm -I$(HOME)/modules/two_index_ops -I$(HOME)/modules/three_index_ops -I$(HOME)/modules/four_index_ops -std=c++0x \
-I$(HOME)/modules/ResponseTheory -I$(HOME)/modules/nevpt2 -I$(HOME)/molcas -I$(HOME)/modules/mps_nevpt

-LIBS += -L$(NEWMATLIB) -lnewmat $(BOOSTLIB) $(LAPACKBLAS) $(MALLOC)
+LIBS := $(LDFLAGS) -L$(NEWMATLIB) -lnewmat $(BOOSTLIB) $(LAPACKBLAS) $(MALLOC) $(LIBS) -lrt
MPI_OPT = -DSERIAL


@@ -127,7 +127,7 @@
#endif
endif
# Intel compiler
- OPT = -DNDEBUG -O2 -g -funroll-loops #-ipo
+ OPT = -DNDEBUG $(OPTFLAGS) -g -funroll-loops
# OPT = -g
# # Useful option to define a newer g++ binary if the default g++ is too old
# OPT += -gxx-name=g++-4.7
--- newmat10/makefile.orig 2023-01-06 15:20:52.879226000 +0100
+++ newmat10/makefile 2023-01-06 15:20:30.392463000 +0100
@@ -1,6 +1,6 @@
#CXX = g++
$(info $(CXX))
-CXXFLAGS = -fPIC -O2 -Wall
+#CXXFLAGS = -fPIC -O2 -Wall

DIFF = ./sdiff
PRE = ./

0 comments on commit d6aeaaf

Please sign in to comment.