From 444ef91e0f622582e190ad68cb9c88d048ca1a94 Mon Sep 17 00:00:00 2001 From: "Bryan W. Weber" Date: Wed, 12 Jun 2019 13:35:28 -0400 Subject: [PATCH] Build the samples on the CI services Requires libomp on macOS from homebrew. OpenMP with Visual C/C++ requires the loop index to be a signed type (from OpenMP < 3.0). --- .travis.yml | 3 +++ appveyor.yml | 1 + samples/cxx/openmp_ignition/openmp_ignition.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 139a86f43..5ce1d7ec8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,7 @@ addons: - scons - boost - python + - libomp ssh_known_hosts: - cantera.org @@ -50,6 +51,7 @@ script: | set -e scons build -j2 python_cmd=/usr/bin/python3 VERBOSE=y python_package=full blas_lapack_libs=lapack,blas optimize=n coverage=y scons test + scons samples scons build sphinx_docs=y doxygen_docs=y sphinx_cmd="/usr/bin/python3 `which sphinx-build`" if [[ "${TRAVIS_PULL_REQUEST}" == "false" ]] && [[ "${TRAVIS_BRANCH}" == "master" ]] && [[ "${TRAVIS_REPO_SLUG}" == "Cantera/cantera" ]]; then openssl aes-256-cbc -k "${ctdeploy_pass}" -in ./doc/ctdeploy_key.enc -out ./doc/ctdeploy_key -d @@ -75,6 +77,7 @@ script: | else scons build -j2 python_cmd=python3 VERBOSE=y python_package=full blas_lapack_libs=lapack,blas optimize=n coverage=y scons test + scons samples fi after_success: | if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then diff --git a/appveyor.yml b/appveyor.yml index 52a7fd912..14d2070a0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,6 +11,7 @@ install: build_script: - cmd: C:\Python37-x64\Scripts\scons build -j2 boost_inc_dir=C:\Libraries\boost_1_62_0 debug=n VERBOSE=y python_package=full +- cmd: C:\Python37-x64\Scripts\scons samples test_script: - ps: | diff --git a/samples/cxx/openmp_ignition/openmp_ignition.cpp b/samples/cxx/openmp_ignition/openmp_ignition.cpp index 557fb6de2..d91318b99 100644 --- a/samples/cxx/openmp_ignition/openmp_ignition.cpp +++ b/samples/cxx/openmp_ignition/openmp_ignition.cpp @@ -34,10 +34,10 @@ void run() } // Points at which to compute ignition delay time - size_t nPoints = 50; + int nPoints = 50; vector_fp T0(nPoints); vector_fp ignition_time(nPoints); - for (size_t i = 0; i < nPoints; i++) { + for (int i = 0; i < nPoints; i++) { T0[i] = 1000 + 500 * ((float) i) / ((float) nPoints); } @@ -51,7 +51,7 @@ void run() // thread in cases where the workload is biased, e.g. calculations for low // T0 take longer than calculations for high T0. #pragma omp parallel for schedule(static, 1) - for (size_t i = 0; i < nPoints; i++) { + for (int i = 0; i < nPoints; i++) { // Get the Cantera objects that were initialized for this thread size_t j = omp_get_thread_num(); IdealGasMix& gas = *gases[j]; @@ -76,7 +76,7 @@ void run() // Print the computed ignition delays writelog(" T (K) t_ig (s)\n"); writelog("-------- ----------\n"); - for (size_t i = 0; i < nPoints; i++) { + for (int i = 0; i < nPoints; i++) { writelog("{: 8.1f} {: 10.3e}\n", T0[i], ignition_time[i]); } }