From 0832ec3583c562b97ec81bd693e4ba50f0c7582a Mon Sep 17 00:00:00 2001 From: Richard Gowers Date: Fri, 22 Jul 2016 11:01:27 +0100 Subject: [PATCH 1/2] Added flag at lib.distances.USED_OPENMP Fixes #883 --- package/CHANGELOG | 2 ++ package/MDAnalysis/lib/distances.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/package/CHANGELOG b/package/CHANGELOG index 658330e50e6..a4d1ccad218 100644 --- a/package/CHANGELOG +++ b/package/CHANGELOG @@ -24,6 +24,8 @@ Enhancements with 'quiet=False' * The 'run' method from all 'AnalysisBase' derived classes return the class itself. + * Added boolean flag at lib.distances.USED_OPENMP to reveal if + OpenMP was used in compilation (Issue #883) Fixes * GROWriter resids now truncated properly (Issue #886) diff --git a/package/MDAnalysis/lib/distances.py b/package/MDAnalysis/lib/distances.py index 6ad2a21e110..a1aab96a50c 100644 --- a/package/MDAnalysis/lib/distances.py +++ b/package/MDAnalysis/lib/distances.py @@ -21,6 +21,8 @@ Fast C-routines to calculate distance arrays from coordinate arrays. Many of the functions also exist in parallel versions, that typically provide higher performance than the serial code. +The boolean attribute MDAnalysis.lib.distances.USED_OPENMP can be +checked to see if OpenMP was used in the compilation of MDAnalysis. Selection of acceleration ("backend") ------------------------------------- @@ -110,6 +112,8 @@ def _run(funcname, args=None, kwargs=None, backend="serial"): ortho_pbc, triclinic_pbc) +from c_distances_openmp import OPENMP_ENABLED as USED_OPENMP + def _box_check(box): """Take a box input and deduce what type of system it represents based From 6ab7b268247ca4fc8860bcc379aaff9f02f5a3cc Mon Sep 17 00:00:00 2001 From: Richard Gowers Date: Fri, 29 Jul 2016 22:09:47 +0100 Subject: [PATCH 2/2] Added test for USED_OPENMP flag --- testsuite/MDAnalysisTests/test_distances.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/testsuite/MDAnalysisTests/test_distances.py b/testsuite/MDAnalysisTests/test_distances.py index 87d92d47a19..3f6108d96f9 100644 --- a/testsuite/MDAnalysisTests/test_distances.py +++ b/testsuite/MDAnalysisTests/test_distances.py @@ -715,3 +715,5 @@ def test_missing_backend_raises_ValueError(self): backend="not_implemented_stuff") +def test_used_openmpflag(): + assert_(isinstance(MDAnalysis.lib.distances.USED_OPENMP, bool))