Parametrize with elisp the output files of the project
This commit is contained in:
parent
dae1ad10f9
commit
910c19c510
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.emacs
|
||||||
16
Makefile
16
Makefile
@ -1,15 +1,17 @@
|
|||||||
ATRIP_ROOT := $(PWD)
|
ATRIP_ROOT := $(PWD)
|
||||||
CONFIG ?= gcc
|
CONFIG ?= gcc
|
||||||
include etc/config/$(CONFIG).mk
|
SOURCES_FILE := Sources.mk
|
||||||
|
|
||||||
|
include $(SOURCES_FILE)
|
||||||
|
include ./etc/emacs.mk
|
||||||
|
include ./etc/config/$(CONFIG).mk
|
||||||
include ./bench/config.mk
|
include ./bench/config.mk
|
||||||
|
|
||||||
EMACS = emacs -q --batch
|
|
||||||
define tangle
|
|
||||||
$(EMACS) $(1) --eval "(require 'org)" --eval '(org-babel-tangle)'
|
|
||||||
endef
|
|
||||||
|
|
||||||
MAIN = README.org
|
MAIN = README.org
|
||||||
SOURCES = $(shell grep -oe ':tangle \+[^ ]\+' $(MAIN) | awk '{print $$2}' | sort -u)
|
|
||||||
|
$(SOURCES_FILE): $(MAIN)
|
||||||
|
echo -n "SOURCES = " > $@
|
||||||
|
$(EMACS) --eval '(atrip-print-sources)' >> $@
|
||||||
|
|
||||||
$(SOURCES): $(MAIN)
|
$(SOURCES): $(MAIN)
|
||||||
$(call tangle,$<)
|
$(call tangle,$<)
|
||||||
|
|||||||
18
README.org
18
README.org
@ -9,8 +9,20 @@ The algorithm uses two main data types, the =Slice= and the
|
|||||||
|
|
||||||
** The slice
|
** The slice
|
||||||
|
|
||||||
#+begin_src c++ :tangle include/Slice.hpp
|
#+begin_src c++ :tangle (atrip-slice-h)
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <vector>
|
||||||
|
#include <mpi.h>
|
||||||
|
|
||||||
|
#include <atrip/Utils.hpp>
|
||||||
|
|
||||||
|
namespace atrip {
|
||||||
|
|
||||||
|
using ABCTuple = std::array<size_t, 3>;
|
||||||
|
using PartialTuple = std::array<size_t, 2>;
|
||||||
|
|
||||||
struct Slice {
|
struct Slice {
|
||||||
|
|
||||||
using F = double;
|
using F = double;
|
||||||
@ -26,7 +38,7 @@ As an example, for the doubles amplitudes \( T^{ab}_{ij} \), one need two kinds
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#+begin_src c++ :tangle include/Slice.hpp
|
#+begin_src c++ :tangle (atrip-slice-h)
|
||||||
// ASSOCIATED TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
// ASSOCIATED TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
struct Location { size_t rank; size_t source; };
|
struct Location { size_t rank; size_t source; };
|
||||||
@ -455,7 +467,7 @@ As an example, for the doubles amplitudes \( T^{ab}_{ij} \), one need two kinds
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
};
|
}; // struct Slice
|
||||||
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& out, Slice::Location const& v) {
|
std::ostream& operator<<(std::ostream& out, Slice::Location const& v) {
|
||||||
|
|||||||
17
config.el
Normal file
17
config.el
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
(require 'subr-x)
|
||||||
|
|
||||||
|
(defun f-join (&rest args)
|
||||||
|
(string-join args "/"))
|
||||||
|
|
||||||
|
(defvar atrip-sources nil)
|
||||||
|
(defun atrip-print-sources ()
|
||||||
|
(princ (string-join atrip-sources " ")))
|
||||||
|
|
||||||
|
(defmacro atrip-def (name body) `(progn (defun ,name () ,body)
|
||||||
|
(push (,name) atrip-sources)))
|
||||||
|
|
||||||
|
;; atrip variables for the org-mode file
|
||||||
|
(atrip-def atrip-include-f "include/atrip")
|
||||||
|
(atrip-def atrip-slice-h (f-join (atrip-include-f) "Slice.hpp"))
|
||||||
|
(atrip-def atrip-utils-h (f-join (atrip-include-f) "Utils.hpp"))
|
||||||
|
(atrip-def atrip-main-h "include/atrip.hpp")
|
||||||
@ -2,5 +2,7 @@ include etc/ctf.mk
|
|||||||
|
|
||||||
CXX = mpic++
|
CXX = mpic++
|
||||||
|
|
||||||
|
CXXFLAGS += -I$(ATRIP_ROOT)/include
|
||||||
|
|
||||||
CXXFLAGS += -I$(CTF_INCLUDE_PATH)
|
CXXFLAGS += -I$(CTF_INCLUDE_PATH)
|
||||||
LDFLAGS += -L$(CTF_BUILD_PATH) -lctf
|
LDFLAGS += -L$(CTF_BUILD_PATH) -lctf
|
||||||
|
|||||||
5
etc/emacs.mk
Normal file
5
etc/emacs.mk
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
EMACS = emacs -q --batch --load config.el
|
||||||
|
define tangle
|
||||||
|
$(EMACS) $(1) --eval "(require 'org)" --eval '(org-babel-tangle)'
|
||||||
|
endef
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user