Fixes to installation with OpenMP (tested) and execution of test-suite

This commit is contained in:
Jean-Paul Pelteret 2016-05-02 11:01:14 +02:00
parent 631e235ef3
commit 5ae7276682
2 changed files with 35 additions and 11 deletions

View File

@ -0,0 +1,13 @@
diff --git a/ADOL-C/examples/additional_examples/openmp_exam/liborpar.cpp b/ADOL-C/examples/additional_examples/openmp_exam/liborpar.cpp
index fc6fc28..14103d2 100644
--- a/ADOL-C/examples/additional_examples/openmp_exam/liborpar.cpp
+++ b/ADOL-C/examples/additional_examples/openmp_exam/liborpar.cpp
@@ -27,7 +27,7 @@ using namespace std;
#include <ctime>
#include <cmath>
-#include "adolc.h"
+#include <adolc/adolc.h>
#ifdef _OPENMP
#include <omp.h>

View File

@ -13,6 +13,8 @@ class AdolC(Package):
variant('openmp', default=False, description='Enable OpenMP support')
variant('sparse', default=False, description='Enable sparse drivers')
variant('tests', default=True, description='Build all included examples as a test case')
patch('openmp_exam.patch')
def install(self, spec, prefix):
make_args = ['--prefix=%s' % prefix]
@ -21,9 +23,12 @@ def install(self, spec, prefix):
# --with-cxxflags=FLAGS use CXXFLAGS=FLAGS (default: -O3 -Wall)
if '+openmp' in spec:
make_args.extend([
'--with-openmp-flag=-fopenmp' # FIXME: Is this required? -I <path to omp.h> -L <LLVM OpenMP library path>
])
if spec.satisfies('%gcc'):
make_args.extend([
'--with-openmp-flag=-fopenmp' # FIXME: Is this required? -I <path to omp.h> -L <LLVM OpenMP library path>
])
else:
raise InstallError("OpenMP flags for compilers other than GCC are not implemented.")
if '+sparse' in spec:
make_args.extend([
@ -48,22 +53,28 @@ def install(self, spec, prefix):
# Copy the config.h file, as some packages might require it
source_directory = self.stage.source_path
config_h = join_path(source_directory,'ADOL-C/src/config.h')
config_h = join_path(source_directory,'ADOL-C','src','config.h')
install(config_h, join_path(prefix.include,'adolc'))
# Install documentation to {prefix}/share
if '+doc' in spec:
install_tree('ADOL-C/doc',join_path(prefix.share,'doc'))
install_tree(join_path('ADOL-C','doc'),
join_path(prefix.share,'doc'))
# Install examples to {prefix}/share
if '+tests' in spec:
install_tree('ADOL-C/examples',join_path(prefix.share,'examples'))
install_tree(join_path('ADOL-C','examples'),
join_path(prefix.share,'examples'))
# Run some examples that don't require user input
# TODO: Check that bundled examples produce the correct results
with working_dir(join_path(source_directory,'ADOL-C/examples')):
Executable('tapeless_scalar')
Executable('tapeless_vector')
with working_dir(join_path(source_directory,'ADOL-C','examples')):
Executable('./tapeless_scalar')()
Executable('./tapeless_vector')()
with working_dir(join_path(source_directory,'ADOL-C/examples/additional_examples')):
Executable('checkpointing/checkpointing')
with working_dir(join_path(source_directory,'ADOL-C','examples','additional_examples')):
Executable('./checkpointing/checkpointing')()
if '+openmp' in spec:
with working_dir(join_path(source_directory,'ADOL-C','examples','additional_examples')):
Executable('./checkpointing/checkpointing')()