diff --git a/.gitignore b/.gitignore index 6f7cc36..b89eb25 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,13 @@ +etc/autotools/ +Makefile.in +build .emacs *.rst doxygen sphinx +aclocal.m4 +autom4te.cache/ +configure include/dbg.h doc/doxygen/ diff --git a/Makefile b/Makefile deleted file mode 100644 index d8e2bd6..0000000 --- a/Makefile +++ /dev/null @@ -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" diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..6386176 --- /dev/null +++ b/Makefile.am @@ -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" diff --git a/Sources.mk b/Sources.mk index 2b85d8d..4d00e65 100644 --- a/Sources.mk +++ b/Sources.mk @@ -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 \ No newline at end of file +_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 diff --git a/atrip.org b/atrip.org index 2416888..302e4aa 100644 --- a/atrip.org +++ b/atrip.org @@ -1645,6 +1645,7 @@ getNodeInfos(std::vector const& nodeNames) { nodeId, globalRank++, localRanks[nodeId]++, + (size_t) std::count(nodeNames.begin(), nodeNames.end(), name) @@ -3117,7 +3118,6 @@ Atrip::Output Atrip::run(Atrip::Input const& in) { using Database = typename Slice::Database; - using LocalDatabase = typename Slice::LocalDatabase; auto communicateDatabase = [ &unions , np diff --git a/bench/Makefile.am b/bench/Makefile.am index 2ea9b15..56fc654 100644 --- a/bench/Makefile.am +++ b/bench/Makefile.am @@ -1,4 +1,5 @@ AM_LDFLAGS = -fopenmp +AM_CPPFLAGS = -I$(top_srcdir)/include/ bin_PROGRAMS = test_main test_main_SOURCES = test_main.cxx @@ -7,6 +8,5 @@ test_main_LDADD = \ -lopenblas \ -lscalapack \ @LIBCTF_LD_LIBRARY_PATH@/libctf.a \ -@abs_top_builddir@/src/libatrip.a +$(top_builddir)/src/libatrip.a -#LDFLAGS += @ATRIP_LDFLAGS@ diff --git a/bench/test_main.cxx b/bench/test_main.cxx index b5e665c..5d12234 100644 --- a/bench/test_main.cxx +++ b/bench/test_main.cxx @@ -7,7 +7,7 @@ #include #include #include -#include +#include #define _print_size(what, size) \ if (rank == 0) { \ diff --git a/configure.ac b/configure.ac index 87f0de0..315e522 100644 --- a/configure.ac +++ b/configure.ac @@ -9,30 +9,32 @@ AC_CONFIG_SRCDIR([.]) AC_PREREQ(2.69) AC_LANG([C++]) AC_CONFIG_MACRO_DIR([./etc/m4]) -AM_INIT_AUTOMAKE([foreign]) +AC_CONFIG_AUX_DIR([./etc/autotools]) +AM_INIT_AUTOMAKE([foreign -Wall]) dnl ----------------------------------------------------------------------- dnl Configure switches AC_ARG_ENABLE(shared, - AS_HELP_STRING( [--enable-shared], - [enable loading compiled files (default=YES)]), - [], [enable_shared=yes]) + AS_HELP_STRING([--enable-shared], + [enable loading compiled + files (default=YES)]), + [], [enable_shared=yes]) dnl LIBGC library options AC_ARG_WITH(libctf-prefix, - AS_HELP_STRING( [--with-libctf-prefix=path], - [prefix for system LIBGC includes and libraries] ), - [LIBCTF_CPATH="$withval/include"; - LIBCTF_LD_LIBRARY_PATH="$withval/lib"; - BUILD_CTF=NO], - [BUILD_CTF=YES]) + AS_HELP_STRING([--with-libctf-prefix=path], + [prefix for CTF includes and libraries] ), + [LIBCTF_CPATH="`readlink -f $withval`/include"; + LIBCTF_LD_LIBRARY_PATH="`readlink -f $withval`/lib"; + BUILD_CTF=NO], + [BUILD_CTF=YES]) AC_ARG_WITH(dgemm, - AS_HELP_STRING( [--without-dgemm], - [Disable dgemm]), - [with_dgemm=NO], [with_dgemm=YES]) + AS_HELP_STRING([--without-dgemm], [Disable dgemm]), + [with_dgemm=NO], + [with_dgemm=YES]) @@ -52,6 +54,7 @@ AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_PROG_CXX dnl sets variable CXX +AM_PROG_AR AC_PROG_CPP dnl sets variable CPP AC_PROG_RANLIB dnl sets variable RANLIB AC_PROG_INSTALL dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM @@ -64,21 +67,31 @@ AC_TYPE_SIZE_T AC_FUNC_MALLOC AX_CXX_COMPILE_STDCXX([11]) - +AX_CXX_STATIC_CAST +AX_CXX_TEMPLATES +AX_CXX_TYPENAME AX_MPI([], [AC_MSG_ERROR([You don not have an MPI Implementation!])]) +AX_PROG_CXX_MPI CXX=${MPICXX} -CXXFLAGS="$CXXFLAGS -I$PWD/include" -CXXFLAGS="$CXXFLAGS -I${LIBCTF_CPATH}" -LDFLAGS="$LDFLAGS -L${LIBCTF_LD_LIBRARY_PATH} -lctf" +dnl ---------- CHECK CTF +if test xYES = x${BUILD_CTF}; then + 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_MSG_RESULT([ @@ -86,11 +99,8 @@ AC_MSG_RESULT([ ----------------------- CXX = $CXX CXXFLAGS = $CXXFLAGS - DEFAULT_INCLUDES = $DEFAULT_INCLUDES LDFLAGS = $LDFLAGS ATRIP_LDFLAGS = $ATRIP_LDFLAGS - bindir = $bindir - libdir = $libdir ]) AC_OUTPUT diff --git a/include/atrip/Tuples.hpp b/include/atrip/Tuples.hpp index d5ac897..26c9d2b 100644 --- a/include/atrip/Tuples.hpp +++ b/include/atrip/Tuples.hpp @@ -125,6 +125,7 @@ getNodeInfos(std::vector const& nodeNames) { nodeId, globalRank++, localRanks[nodeId]++, + (size_t) std::count(nodeNames.begin(), nodeNames.end(), name) diff --git a/src/Makefile.am b/src/Makefile.am index 1c42640..e15f5dd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,2 +1,8 @@ +AUTOMAKE_OPTIONS = subdir-objects + +AM_CXXFLAGS = -Wall --pedantic + lib_LIBRARIES = libatrip.a -libatrip_a_SOURCES = atrip/Atrip.cxx + +libatrip_a_CPPFLAGS = -I$(top_srcdir)/include/ +libatrip_a_SOURCES = ./atrip/Atrip.cxx diff --git a/src/atrip/Atrip.cxx b/src/atrip/Atrip.cxx index b1aab06..e10600b 100644 --- a/src/atrip/Atrip.cxx +++ b/src/atrip/Atrip.cxx @@ -157,7 +157,6 @@ Atrip::Output Atrip::run(Atrip::Input const& in) { using Database = typename Slice::Database; - using LocalDatabase = typename Slice::LocalDatabase; auto communicateDatabase = [ &unions , np