IF(NOT ${mpi_run} EQUAL "")
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK
+ DEPENDS ${_target}
COMMAND mpirun -n ${mpi_run} ./${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 || (rm ${_target}-OK && exit 1)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
ELSE()
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK
+ DEPENDS ${_target}
COMMAND ./${_target} > ${CMAKE_CURRENT_BINARY_DIR}/${_target}-OK 2>&1 || (rm ${_target}-OK && exit 1)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
make_quicktest("mpi" ${_mybuild} 2)
ENDIF()
+# Test if TBB works correctly
+IF (DEAL_II_WITH_THREADS)
+ make_quicktest("tbb" ${_mybuild} "")
+ENDIF()
+
# Test p4est. This test exposes a bug in OpenMPI 1.3 and 1.4
# Update to OpenMPI 1.5 or newer.
IF (DEAL_II_WITH_P4EST)
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: affinity.cc 31527 2013-11-03 09:58:45Z maier $
+//
+// Copyright (C) 2013 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+// test Threads::new_task and WorkStream::run
+
+#include <deal.II/base/thread_management.h>
+#include <deal.II/base/work_stream.h>
+#include <iostream>
+
+using namespace dealii;
+
+void add_one(unsigned int &var)
+{
+ var += 1;
+}
+
+void test1()
+{
+ unsigned int tmp = 1;
+ Threads::Task<> task = Threads::new_task (&add_one,tmp);
+ task.join();
+ if (tmp!=2)
+ exit(1);
+}
+
+struct scratch_data
+{
+};
+
+struct copy_data
+{
+ int value;
+};
+
+
+void assemble(const std::vector<int>::iterator &it,
+ scratch_data &scratch,
+ copy_data &data)
+{
+ std::cout << "hello!" << std::endl;
+
+ data.value +=(*it)*(*it);
+}
+
+void copy(int & value, const copy_data &data)
+{
+ value += data.value;
+}
+
+void test2()
+{
+ std::vector<int> v(3);
+ v[0] = 3;
+ v[1] = 5;
+ v[2] = 1;
+ int result = 0;
+ WorkStream::run(v.begin(),
+ v.end(),
+ &assemble,
+ std_cxx1x::bind(©,
+ std_cxx1x::ref(result),
+ std_cxx1x::_1),
+ scratch_data(), copy_data());
+ std::cout << "result: " << result << std::endl;
+
+ if (result != (3*3+5*5+1*1))
+ exit(2);
+}
+
+int main ()
+{
+ test1();
+ test2();
+}