Now compiling

This commit is contained in:
Alejandro Gallo 2022-03-11 14:27:52 +01:00
parent a7868b49c1
commit c6eb805078
11 changed files with 86 additions and 145 deletions

6
.gitignore vendored
View File

@ -1,7 +1,13 @@
etc/autotools/
Makefile.in
build
.emacs .emacs
*.rst *.rst
doxygen doxygen
sphinx sphinx
aclocal.m4
autom4te.cache/
configure
include/dbg.h include/dbg.h
doc/doxygen/ doc/doxygen/

113
Makefile
View File

@ -1,113 +0,0 @@
include atrip.mk
CONFIG ?= gcc
PREFIX ?= /usr
SOURCES_FILE := Sources.mk
-include config.mk
include $(SOURCES_FILE)
include ./etc/make/emacs.mk
include ./etc/config/$(CONFIG).mk
include ./bench/config.mk
$(info ==ATRIP== using configuration CONFIG=$(CONFIG))
ORG_MAIN = atrip.org
OBJ_FILES = $(patsubst %.cxx,%.o,$(filter-out %.hpp,$(ATRIP_SOURCES)))
DEP_FILES = $(patsubst %.o,%.d,$(OBJ_FILES))
ATRIP_SHARED_LIBRARY = lib/$(CONFIG)/libatrip.so
ATRIP_STATIC_LIBRARY = lib/$(CONFIG)/libatrip.a
extern: $(EXTERNAL_DEPENDENCIES)
clean-extern: CLEANING=yes
clean-extern:
rm -vrf extern
#$(DEP_FILES): extern
.PHONY: extern
lib: extern
lib: $(DEP_FILES)
lib: $(ATRIP_SHARED_LIBRARY) $(ATRIP_STATIC_LIBRARY)
static: $(ATRIP_STATIC_LIBRARY)
shared: $(ATRIP_SHARED_LIBRARY)
.PHONY: lib static shared
ifeq ($(MAKECMD),lib)
include $(DEP_FILES)
endif
$(ATRIP_SHARED_LIBRARY): $(OBJ_FILES)
mkdir -p $(@D)
$(CXX) -shared $< $(CXXFLAGS) $(LDFLAGS) -o $@
$(ATRIP_STATIC_LIBRARY): $(OBJ_FILES)
mkdir -p $(@D)
$(AR) rcs $@ $<
$(SOURCES_FILE): config.el
echo -n "ATRIP_SOURCES = " > $@
$(EMACS) -f atrip-print-sources >> $@
print:
$(info $(filter-out %.hpp,$(ATRIP_SOURCES)))
$(ATRIP_SOURCES): $(ORG_MAIN)
$(call tangle,$<)
tangle: $(ATRIP_SOURCES)
clean-emacs: CLEANING=yes
clean-emacs:
-rm -v $(ATRIP_SOURCES)
clean: CLEANING=yes
clean:
-rm -v \
$(OBJ_FILES) \
$(DEP_FILES) \
$(ATRIP_SHARED_LIBRARY) \
$(ATRIP_STATIC_LIBRARY)
clean-all: CLEANING=yes
clean-all: bench-clean clean-emacs clean clean-extern
bench: $(BENCH_TARGETS)
$(BENCH_TARGETS): $(ATRIP_STATIC_LIBRARY)
.PHONY: clean tangle bench
%: %.o
$(info [bin] $@)
$(CXX) $< $(CXXFLAGS) $(LDFLAGS) -o $@
%.o: %.cxx
$(info [obj] $@)
$(CXX) -c $< $(CXXFLAGS) -o $@
%.d: %.cxx
$(info [dep] $@)
$(CXX) -M $< $(CXXFLAGS) -o $@
.PHONY: install
install:
mkdir -p $(PREFIX)/include
cp -r include/* $(PREFIX)/include/
mkdir -p $(PREFIX)/lib
cp $(wildcard $(ATRIP_SHARED_LIBRARY) $(ATRIP_STATIC_LIBRARY)) $(PREFIX)/lib/
.PHONY: html
EMACS_HTML = $(EMACS) --load ./etc/emacs/html.el
HTML_MAIN = $(patsubst %.org,%.html,$(ORG_MAIN))
html: $(HTML_MAIN)
%.html: %.org
$(EMACS_HTML) $< -f org-html-export-to-html
%.rst: %.org
$(EMACS_HTML) $< -f org-rst-export-to-rst
.PHONY: dbg
dbg: include/dbg.h
include/dbg.h:
wget -O $@ "https://raw.githubusercontent.com/sharkdp/dbg-macro/master/dbg.h"

32
Makefile.am Normal file
View File

@ -0,0 +1,32 @@
include ./etc/make/emacs.mk
SUBDIRS = src bench
_ATRIPSRCS = Sources.mk
## include $(_ATRIPSRCS)
ORG_MAIN = atrip.org
ATRIP_SHARED_LIBRARY = lib/$(CONFIG)/libatrip.so
ATRIP_STATIC_LIBRARY = lib/$(CONFIG)/libatrip.a
tangle: $(ORG_MAIN)
$(call tangle,$<)
clean-emacs: CLEANING=yes
clean-emacs:
-rm -v $(_ATRIPSRCS)
.PHONY: tangle
EMACS_HTML = $(EMACS) --load ./etc/emacs/html.el
%.html: %.org
$(EMACS_HTML) $< -f org-html-export-to-html
%.rst: %.org
$(EMACS_HTML) $< -f org-rst-export-to-rst
.PHONY: dbg
dbg: include/dbg.h
include/dbg.h:
wget -O $@ "https://raw.githubusercontent.com/sharkdp/dbg-macro/master/dbg.h"

View File

@ -1 +1 @@
ATRIP_SOURCES = include/atrip.hpp src/atrip/Atrip.cxx include/atrip/Atrip.hpp include/atrip/Debug.hpp include/atrip/Equations.hpp include/atrip/Tuples.hpp include/atrip/Unions.hpp include/atrip/RankMap.hpp include/atrip/Blas.hpp include/atrip/Utils.hpp include/atrip/SliceUnion.hpp include/atrip/Slice.hpp _ATRIPSRCS = include/atrip.hpp src/atrip/Atrip.cxx include/atrip/Atrip.hpp include/atrip/Debug.hpp include/atrip/Equations.hpp include/atrip/Tuples.hpp include/atrip/Unions.hpp include/atrip/RankMap.hpp include/atrip/Blas.hpp include/atrip/Utils.hpp include/atrip/SliceUnion.hpp include/atrip/Slice.hpp

View File

@ -1645,6 +1645,7 @@ getNodeInfos(std::vector<string> const& nodeNames) {
nodeId, nodeId,
globalRank++, globalRank++,
localRanks[nodeId]++, localRanks[nodeId]++,
(size_t)
std::count(nodeNames.begin(), std::count(nodeNames.begin(),
nodeNames.end(), nodeNames.end(),
name) name)
@ -3117,7 +3118,6 @@ Atrip::Output Atrip::run(Atrip::Input<F> const& in) {
using Database = typename Slice<F>::Database; using Database = typename Slice<F>::Database;
using LocalDatabase = typename Slice<F>::LocalDatabase;
auto communicateDatabase auto communicateDatabase
= [ &unions = [ &unions
, np , np

View File

@ -1,4 +1,5 @@
AM_LDFLAGS = -fopenmp AM_LDFLAGS = -fopenmp
AM_CPPFLAGS = -I$(top_srcdir)/include/
bin_PROGRAMS = test_main bin_PROGRAMS = test_main
test_main_SOURCES = test_main.cxx test_main_SOURCES = test_main.cxx
@ -7,6 +8,5 @@ test_main_LDADD = \
-lopenblas \ -lopenblas \
-lscalapack \ -lscalapack \
@LIBCTF_LD_LIBRARY_PATH@/libctf.a \ @LIBCTF_LD_LIBRARY_PATH@/libctf.a \
@abs_top_builddir@/src/libatrip.a $(top_builddir)/src/libatrip.a
#LDFLAGS += @ATRIP_LDFLAGS@

View File

@ -7,7 +7,7 @@
#include <iostream> #include <iostream>
#include <atrip.hpp> #include <atrip.hpp>
#include <atrip/Debug.hpp> #include <atrip/Debug.hpp>
#include <bench/CLI11.hpp> #include <CLI11.hpp>
#define _print_size(what, size) \ #define _print_size(what, size) \
if (rank == 0) { \ if (rank == 0) { \

View File

@ -9,30 +9,32 @@ AC_CONFIG_SRCDIR([.])
AC_PREREQ(2.69) AC_PREREQ(2.69)
AC_LANG([C++]) AC_LANG([C++])
AC_CONFIG_MACRO_DIR([./etc/m4]) AC_CONFIG_MACRO_DIR([./etc/m4])
AM_INIT_AUTOMAKE([foreign]) AC_CONFIG_AUX_DIR([./etc/autotools])
AM_INIT_AUTOMAKE([foreign -Wall])
dnl ----------------------------------------------------------------------- dnl -----------------------------------------------------------------------
dnl Configure switches dnl Configure switches
AC_ARG_ENABLE(shared, AC_ARG_ENABLE(shared,
AS_HELP_STRING( [--enable-shared], AS_HELP_STRING([--enable-shared],
[enable loading compiled files (default=YES)]), [enable loading compiled
[], [enable_shared=yes]) files (default=YES)]),
[], [enable_shared=yes])
dnl LIBGC library options dnl LIBGC library options
AC_ARG_WITH(libctf-prefix, AC_ARG_WITH(libctf-prefix,
AS_HELP_STRING( [--with-libctf-prefix=path], AS_HELP_STRING([--with-libctf-prefix=path],
[prefix for system LIBGC includes and libraries] ), [prefix for CTF includes and libraries] ),
[LIBCTF_CPATH="$withval/include"; [LIBCTF_CPATH="`readlink -f $withval`/include";
LIBCTF_LD_LIBRARY_PATH="$withval/lib"; LIBCTF_LD_LIBRARY_PATH="`readlink -f $withval`/lib";
BUILD_CTF=NO], BUILD_CTF=NO],
[BUILD_CTF=YES]) [BUILD_CTF=YES])
AC_ARG_WITH(dgemm, AC_ARG_WITH(dgemm,
AS_HELP_STRING( [--without-dgemm], AS_HELP_STRING([--without-dgemm], [Disable dgemm]),
[Disable dgemm]), [with_dgemm=NO],
[with_dgemm=NO], [with_dgemm=YES]) [with_dgemm=YES])
@ -52,6 +54,7 @@ AC_CANONICAL_BUILD
AC_CANONICAL_HOST AC_CANONICAL_HOST
AC_PROG_CXX dnl sets variable CXX AC_PROG_CXX dnl sets variable CXX
AM_PROG_AR
AC_PROG_CPP dnl sets variable CPP AC_PROG_CPP dnl sets variable CPP
AC_PROG_RANLIB dnl sets variable RANLIB AC_PROG_RANLIB dnl sets variable RANLIB
AC_PROG_INSTALL dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM AC_PROG_INSTALL dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM
@ -64,21 +67,31 @@ AC_TYPE_SIZE_T
AC_FUNC_MALLOC AC_FUNC_MALLOC
AX_CXX_COMPILE_STDCXX([11]) AX_CXX_COMPILE_STDCXX([11])
AX_CXX_STATIC_CAST
AX_CXX_TEMPLATES
AX_CXX_TYPENAME
AX_MPI([], AX_MPI([],
[AC_MSG_ERROR([You don not have an MPI Implementation!])]) [AC_MSG_ERROR([You don not have an MPI Implementation!])])
AX_PROG_CXX_MPI
CXX=${MPICXX} CXX=${MPICXX}
CXXFLAGS="$CXXFLAGS -I$PWD/include" dnl ---------- CHECK CTF
CXXFLAGS="$CXXFLAGS -I${LIBCTF_CPATH}" if test xYES = x${BUILD_CTF}; then
LDFLAGS="$LDFLAGS -L${LIBCTF_LD_LIBRARY_PATH} -lctf" AC_MSG_ERROR([Sorry, building CTF not supported yet provide a build path
with --with-libctf-prefix=path])
else
CPPFLAGS="$CPPFLAGS -I${LIBCTF_CPATH}"
LDFLAGS="$LDFLAGS -L${LIBCTF_LD_LIBRARY_PATH} -lctf"
AC_CHECK_HEADER([ctf.hpp],
[],
[AC_MSG_ERROR([no ctf.hpp])])
fi
AC_CONFIG_FILES([
src/Makefile
bench/Makefile
etc/config/auto.mk
])
AC_CONFIG_FILES([Makefile
src/Makefile
bench/Makefile
])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
AC_MSG_RESULT([ AC_MSG_RESULT([
@ -86,11 +99,8 @@ AC_MSG_RESULT([
----------------------- -----------------------
CXX = $CXX CXX = $CXX
CXXFLAGS = $CXXFLAGS CXXFLAGS = $CXXFLAGS
DEFAULT_INCLUDES = $DEFAULT_INCLUDES
LDFLAGS = $LDFLAGS LDFLAGS = $LDFLAGS
ATRIP_LDFLAGS = $ATRIP_LDFLAGS ATRIP_LDFLAGS = $ATRIP_LDFLAGS
bindir = $bindir
libdir = $libdir
]) ])
AC_OUTPUT AC_OUTPUT

View File

@ -125,6 +125,7 @@ getNodeInfos(std::vector<string> const& nodeNames) {
nodeId, nodeId,
globalRank++, globalRank++,
localRanks[nodeId]++, localRanks[nodeId]++,
(size_t)
std::count(nodeNames.begin(), std::count(nodeNames.begin(),
nodeNames.end(), nodeNames.end(),
name) name)

View File

@ -1,2 +1,8 @@
AUTOMAKE_OPTIONS = subdir-objects
AM_CXXFLAGS = -Wall --pedantic
lib_LIBRARIES = libatrip.a lib_LIBRARIES = libatrip.a
libatrip_a_SOURCES = atrip/Atrip.cxx
libatrip_a_CPPFLAGS = -I$(top_srcdir)/include/
libatrip_a_SOURCES = ./atrip/Atrip.cxx

View File

@ -157,7 +157,6 @@ Atrip::Output Atrip::run(Atrip::Input<F> const& in) {
using Database = typename Slice<F>::Database; using Database = typename Slice<F>::Database;
using LocalDatabase = typename Slice<F>::LocalDatabase;
auto communicateDatabase auto communicateDatabase
= [ &unions = [ &unions
, np , np