Skip to content

Commit

Permalink
Finalize code structure, integrate tuning, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
msricher committed Mar 4, 2024
1 parent e2edb00 commit f4ee78d
Show file tree
Hide file tree
Showing 23 changed files with 363 additions and 1,759 deletions.
30 changes: 19 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ ifeq ($(shell uname -s),Darwin)
CXXFLAGS += -undefined dynamic_lookup
endif

ifneq ($(BUILD_NATIVE),)
CXXFLAGS += -march=native -mtune=native
endif

ifneq ($(RUN_TUNING),)
CXXFLAGS += -DRUN_TUNING=1
endif
Expand All @@ -18,7 +22,7 @@ endif

# Build C and Python libraries
.PHONY: all
all: libpermanent.a libpermanent.so permanent/permanent.so
all: libpermanent.a libpermanent.so permanent/permanent.so

# Build C libraries
.PHONY: c
Expand Down Expand Up @@ -54,28 +58,32 @@ compile_flags.txt:
echo "$(CXXFLAGS)" | sed 's/ /\n/g' > $@

# Find tuning parameters
src/tuning.h: src/permanent.h src/tuning.cc src/tuning.py
src/tuning.h: src/permanent.h src/permanent.cc src/tuning.cc tools/tuning.py
$(CXX) $(CXXFLAGS) -o src/tuning src/permanent.cc src/tuning.cc
src/tuning
[ -n "$(RUN_TUNING)" ] && $(PYTHON) src/tuning.py || true
@if [ -n "$(RUN_TUNING)" ]; then \
echo "running tuning..."; \
src/tuning; \
echo "writing custom tuning.h"; \
$(PYTHON) tools/tuning.py; \
else \
echo "writing default tuning.h"; \
src/tuning; \
fi

# Compile Python library
permanent/permanent.so: src/tuning.h src/permanent.h src/permanent.cc src/py_permanent.cc
permanent/permanent.so: src/tuning.h src/permanent.h src/permanent.cc src/py_permanent.cc tools/include_dirs.py
$(CXX) $(CXXFLAGS) -DWITH_TUNING_FILE=1 \
-I$(shell $(PYTHON) -c "import sysconfig; print(sysconfig.get_paths()['include'])") \
-I$(shell $(PYTHON) -c "import numpy; print(numpy.get_include())") \
$(shell $(PYTHON) tools/include_dirs.py) \
-shared -o $@ src/permanent.cc src/py_permanent.cc

# Compile object code
src/libpermanent.o: src/tuning.h src/permanent.h src/permanent.cc
$(CXX) $(CXXFLAGS) -DWITH_TUNING_FILE=1 -c -o $@ src/permanent.cc

# Compile static library
# Compile static C library
libpermanent.a: src/libpermanent.o
$(AR) crs $@ $^

# Compile shared library
# Compile shared C library
libpermanent.so: src/libpermanent.o
$(CXX) $(CXXFLAGS) -shared -o $@ $^


8 changes: 8 additions & 0 deletions docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
API
===

.. autofunction:: permanent.opt

.. autofunction:: permanent.combinatoric

.. autofunction:: permanent.glynn

.. autofunction:: permanent.ryser
2 changes: 2 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import sphinx_rtd_theme

import permanent

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
Expand Down
8 changes: 0 additions & 8 deletions old_docs/Makefile

This file was deleted.

23 changes: 0 additions & 23 deletions old_docs/Notes.md

This file was deleted.

95 changes: 0 additions & 95 deletions old_docs/main.bib

This file was deleted.

Binary file removed old_docs/main.pdf
Binary file not shown.
184 changes: 0 additions & 184 deletions old_docs/main.tex

This file was deleted.

Loading

0 comments on commit f4ee78d

Please sign in to comment.