summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkguerda-idris <84066930+kguerda-idris@users.noreply.github.com>2021-09-29 15:29:31 +0200
committerGitHub <noreply@github.com>2021-09-29 15:29:31 +0200
commit1c7e7ce2da8bb362c184fb6eae71fe7e36356494 (patch)
tree92fdc31870b6d5384c8ba83ff72d85a2d5a1eee6 /test
parent7dde9e8e4b6aae756e103d49198caaa4f24150e3 (diff)
[MRG] OpenMP support (#260)
* Added : OpenMP support Restored : Epsilon and Debug mode Replaced : parmap => multiprocessing is now replace by multithreading * Commit clean up * Number of CPUs correctly calculated on SLURM clusters * Corrected number of processes for cluster slurm * Mistake corrected * parmap is now deprecated * Now a different solver is used depending on the requested number of threads * Tiny mistake corrected * Folders are now in the ot library instead of at the root * Helpers is now correctly placed * Attempt to make compilation work smoothly * OS compatible path * NumThreads now defaults to 1 * Better flags * Mistake corrected in case of OpenMP unavailability * Revert OpenMP flags modification, which do not compile on Windows * Test helper functions * Helpers comments * Documentation update * File title corrected * Warning no longer using print * Last attempt for macos compilation * pls work * atempt * solving a type error * TypeError OpenMP * Compilation finally working on Windows * Bug solve, number of threads now correctly selected * 64 bits solver to avoid overflows for bigger problems * 64 bits EMD corrected Co-authored-by: kguerda-idris <ssos023@jean-zay3.idris.fr> Co-authored-by: ncassereau-idris <84033440+ncassereau-idris@users.noreply.github.com> Co-authored-by: ncassereau <nathan.cassereau@idris.fr> Co-authored-by: RĂ©mi Flamary <remi.flamary@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_helpers.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_helpers.py b/test/test_helpers.py
new file mode 100644
index 0000000..8bd0015
--- /dev/null
+++ b/test/test_helpers.py
@@ -0,0 +1,26 @@
+"""Tests for helpers functions """
+
+# Author: Remi Flamary <remi.flamary@polytechnique.edu>
+#
+# License: MIT License
+
+import os
+import sys
+
+sys.path.append(os.path.join("ot", "helpers"))
+
+from openmp_helpers import get_openmp_flag, check_openmp_support # noqa
+from pre_build_helpers import _get_compiler, compile_test_program # noqa
+
+
+def test_helpers():
+
+ compiler = _get_compiler()
+
+ get_openmp_flag(compiler)
+
+ s = '#include <stdio.h>\n#include <stdlib.h>\n\nint main(void) {\n\tprintf("Hello world!\\n");\n\treturn 0;\n}'
+ output, _ = compile_test_program(s)
+ assert len(output) == 1 and output[0] == "Hello world!"
+
+ check_openmp_support()