Index: configure.ac =================================================================== --- configure.ac (revision 164) +++ configure.ac (working copy) @@ -89,6 +89,20 @@ -lncurses) ]) +# enable OpenMP support upon request +# +AC_ARG_WITH( [openmp], + [AS_HELP_STRING([--with-openmp], + [enable OpenMP (experimental)])], + [], + [with_openmp=xno]) + +OPENMP= + AS_IF( + [test "x$with_openmp" == xyes], + [AC_SUBST([OPENMP], ["-fopenmp"])] + ) + AC_CONFIG_FILES([Makefile debian/Makefile debian/source/Makefile Index: src/SkalarFunction.cc =================================================================== --- src/SkalarFunction.cc (revision 164) +++ src/SkalarFunction.cc (working copy) @@ -64,6 +64,7 @@ if (count == 0) return eval_fill_B(B); Value_P Z(new Value(B->get_shape(), LOC)); +#pragma omp parallel for loop(c, count) { const Cell * cell_B = &B->get_ravel(c); @@ -138,6 +139,7 @@ const Cell * cell_A = &A->get_ravel(0); Value_P Z(new Value(B->get_shape(), LOC)); +#pragma omp parallel for loop(c, count) { const Cell * cell_B = &B->get_ravel(c); @@ -158,6 +160,7 @@ const Cell * cell_B = &B->get_ravel(0); Value_P Z(new Value(A->get_shape(), LOC)); +#pragma omp parallel for loop(c, count) { const Cell * cell_A = &A->get_ravel(c); @@ -181,6 +184,7 @@ Value_P Z(new Value(A->get_shape(), LOC)); +#pragma omp parallel for loop(c, count) { const Cell * cell_A = &A->get_ravel(c); Index: src/SystemLimits.def =================================================================== --- src/SystemLimits.def (revision 164) +++ src/SystemLimits.def (working copy) @@ -24,6 +24,14 @@ syl1("smallest integer" , SMALL_INT , -9223372036854770000LL) syl1("largest numeric exponent" , LARGEST_EXPO , 308 ) syl1("max. shared variable size (bytes)" , MAX_SVAR_SIZE , 65000 ) +#ifdef _OPENMP +syl2("OpenMP dynamic adjustment" , OMP_DYNAMIC , omp_get_dynamic() ) +syl2("OpenMP nested parallelism" , OMP_NESTED , omp_get_nested() ) +syl2("OpenMP thread limit" , OMP_LIMIT_THREADS , omp_get_thread_limit()) +syl2("OpenMP max active levels" , OMP_MAX_LEVELS , omp_get_max_active_levels()) +syl2("OpenMP max threads per region" , OMP_MAX_THREADS , omp_get_max_threads()) +syl2("OpenMP processor count" , OMP_NUM_PROCS , omp_get_num_procs() ) +#endif #undef syl1 #undef syl2 Index: src/SystemLimits.hh =================================================================== --- src/SystemLimits.hh (revision 164) +++ src/SystemLimits.hh (working copy) @@ -23,6 +23,10 @@ /// System limits and default values defined for this interpreter. +#ifdef _OPENMP +#include +#endif + enum { #define syl1(_n, e, v) e = v, Index: src/SystemVariable.cc =================================================================== --- src/SystemVariable.cc (revision 164) +++ src/SystemVariable.cc (working copy) @@ -45,6 +45,10 @@ #include "Value.hh" #include "Workspace.hh" +#ifdef _OPENMP +#include +#endif + UCS_string Quad_QUOTE::prompt; ShapeItem Quad_SYL::si_depth_limit = 0; @@ -929,6 +933,23 @@ ravel_count_limit = cells; } +#ifdef _OPENMP + else if (x == SYL_OMP_DYNAMIC) // OpenMP dynamic adjustment + { + if (b < 0 || b > 1) DOMAIN_ERROR; + omp_set_dynamic((int)b); + } + else if (x == SYL_OMP_NESTED) // OpenMP nested parallelism + { + if (b < 0 || b > 1) DOMAIN_ERROR; + omp_set_nested((int)b); + } + else if (x == SYL_OMP_MAX_LEVELS) // OpenMP max active levels + { + if (b < 0) DOMAIN_ERROR; + omp_set_max_active_levels((int)b); + } +#endif else { INDEX_ERROR; Index: src/Value.cc =================================================================== --- src/Value.cc (revision 164) +++ src/Value.cc (working copy) @@ -1267,6 +1267,7 @@ ++error_count; } +#pragma omp parallel for loop(c, element_count()) { const Cell * cell = &get_ravel(c); Index: src/main.cc =================================================================== --- src/main.cc (revision 164) +++ src/main.cc (working copy) @@ -508,6 +508,9 @@ "", c1, +#ifdef _OPENMP + "Compiled with OpenMP support (experimental)", +#endif "", "Copyright (C) 2008-2014 Dr. Jürgen Sauermann", "Banner by FIGlet: www.figlet.org",