Commit 8db7171c authored by Philippe SWARTVAGHER's avatar Philippe SWARTVAGHER
Browse files

Reorganize Python modules to make a package and install it via automake

parent 87b57421
SUBDIRS = src
if INSTALL_PYTHON_MODULE
SUBDIRS += python
endif
......@@ -127,8 +127,39 @@ fi
AC_SUBST(LARGE_MCMODEL_FLAGS)
# Python
AM_PATH_PYTHON([3.6],, [:])
install_python_package=yes
if test "$PYTHON" != :
then
AC_PYTHON_MODULE(pip, [], [install_python_package=no])
AC_PYTHON_MODULE(pandas, [], [install_python_package=no])
AC_PYTHON_MODULE(scipy, [], [install_python_package=no])
AC_PYTHON_MODULE(numpy, [], [install_python_package=no])
AC_PYTHON_MODULE(matplotlib, [], [install_python_package=no])
AC_PYTHON_MODULE(PIL, [], [install_python_package=no])
if test x$install_python_package = xyes
then
PYTHON_PKG_NAME=memory_contention
AC_SUBST([PYTHON_PKG_NAME])
AC_CONFIG_FILES([python/setup.cfg])
fi
else
install_python_package=no
fi
AM_CONDITIONAL(INSTALL_PYTHON_MODULE, test x$install_python_package = xyes)
AC_MSG_CHECKING(whether Python package can be installed)
AC_MSG_RESULT($install_python_package)
AM_CONDITIONAL(HAS_CUSTOM_INSTALL_PREFIX, test x${prefix} != xNONE)
# End
AC_CONFIG_FILES([Makefile src/Makefile])
AC_CONFIG_FILES([Makefile src/Makefile python/Makefile])
AC_OUTPUT
AC_MSG_NOTICE([
......@@ -140,4 +171,5 @@ Configuration summary:
StarPU: $have_starpu
MKL: $have_mkl
AVX: $available_avx
Python: $install_python_package
])
......@@ -6,8 +6,14 @@
#:use-module (guix git-download)
#:use-module (guix licenses)
#:use-module (guix packages)
#:use-module (inria storm))
#:use-module (inria storm)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
#:use-module (gnu packages python-science)
#:use-module (gnu packages python-xyz))
; This file is a template. Use package transformations like --with-commit or
; --with-source to use a recent version of memory-contention.
(define-public memory-contention
(package
(name "memory-contention")
......@@ -24,14 +30,21 @@
(sha256
(base32 "1w0h97rkagw1gm3cxn54g4diqlh60r2rnf6kiyvl99b1f2fy7g75"))))
(build-system gnu-build-system)
(native-inputs
`(("autoconf" ,autoconf)
("pkg-config" ,pkg-config)
("automake" ,automake)))
(arguments
'(#:out-of-source? #t
#:phases (modify-phases %standard-phases
(add-before 'install 'pre-install
(lambda _ (setenv "SOURCE_DATE_EPOCH" "315532800") #t)))))
(native-inputs (list autoconf pkg-config automake python-wrapper python-pip python-setuptools python-wheel))
(propagated-inputs
`(("hwloc" ,hwloc "lib")
("mpi" ,openmpi)
("starpu" ,starpu)))
(list `(,hwloc "lib")
openmpi
starpu
python-pandas
python-scipy
python-numpy
python-matplotlib
python-pillow))
(synopsis "Set of benchmarks and tools to measure interferences between computations and communications")
(description
"memory-contention is composed of a set of benchmarks to measure
......
# From starpu/m4/libs.m4
# AC_PYTHON_MODULE(modulename, [action-if-found], [action-if-not-found])
# Check if the given python module is available
AC_DEFUN([AC_PYTHON_MODULE],
[
AC_MSG_CHECKING(for python3 $1 module)
echo "import $1" | $PYTHON - 2>/dev/null
if test $? -ne 0 ; then
AC_MSG_RESULT(no)
$3
else
AC_MSG_RESULT(yes)
$2
fi
])
dist_bin_SCRIPTS = \
basic_openmp_memset2paje.py \
plot_comm_comp.py \
plot_comm_hist.py \
plot_comm_stream.py \
plot_freq.py \
plot_model.py \
plot_pmutools.py
all-local:
cp $(srcdir)/pyproject.toml .
cp -R $(srcdir)/$(PYTHON_PKG_NAME) .
install-exec-local:
if HAS_CUSTOM_INSTALL_PREFIX
$(PYTHON) -m pip install --disable-pip-version-check --upgrade --no-build-isolation --target $(pythondir) .
else
$(PYTHON) -m pip install --disable-pip-version-check --upgrade --no-build-isolation --system .
endif
uninstall-local:
if HAS_CUSTOM_INSTALL_PREFIX
PYTHONPATH=$(pythondir):$(PYTHONPATH) $(PYTHON) -m pip uninstall --yes $(PYTHON_PKG_NAME)
else
$(PYTHON) -m pip uninstall --yes $(PYTHON_PKG_NAME)
endif
#!/usr/bin/env python3
import argparse
import math
import pandas as pd
......
from .comm_comp_fit import *
from .comm_comp_model import *
from .comm_comp import *
from .hwloc import *
from .merge_images import *
from .plot_base import *
......@@ -6,7 +6,7 @@ from matplotlib.ticker import MaxNLocator
import os
import re
from plot_base import byte_formatter, byte_formatter_func, get_comm_durations, compute_stats
from .plot_base import byte_formatter, byte_formatter_func, get_comm_durations, compute_stats
_mem_bw = "Memory Bandwidth (MB/s)"
......
import statistics
from comm_comp import FilesParser, CompMetric
from .comm_comp import FilesParser, CompMetric
class CommCompModel:
......
import unittest
from hwloc import *
from .hwloc import *
class TestHwlocTopology(unittest.TestCase):
def test_henri_subnuma(self):
......
#!/usr/bin/env python3
import sys
from plot_base import *
from comm_comp import *
from memory_contention import *
FILL_ALPHA = 0.3
......
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import sys
import os
from plot_base import *
from memory_contention import *
HIST_MIN_OPT = "--min="
HIST_MAX_OPT = "--max="
......
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import sys
import os
import re
from plot_base import *
from memory_contention import *
SHOW_STREAM_RESULTS_OPT = "--show-stream"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment