Kokkos Node API and Local Linear Algebra Kernels Version of the Day
Kokkos_TBBNode.cpp
00001 #include "Kokkos_TBBNode.hpp"
00002 #include <Teuchos_ParameterList.hpp>
00003 #include <iostream>
00004 
00005 // tbb::task_scheduler_init Kokkos::TBBNode::tsi_(tbb::task_scheduler_init::deferred);
00006 
00007 namespace Kokkos {
00008 
00009   TBBNode::TBBNode(Teuchos::ParameterList &pl) : alreadyInit_(false), tsi_(tbb::task_scheduler_init::deferred) {
00010     int numThreads = pl.get<int>("Num Threads",-1);
00011     int verbose = pl.get<int>("Verbose",0);
00012     if (numThreads >= 0) {
00013       if (verbose) {
00014         std::cout << "TBBNode initializing with numThreads == " << numThreads << std::endl;
00015       }
00016       init(numThreads);
00017     }
00018   }
00019 
00020   void TBBNode::init(int numThreads) {
00021     if (alreadyInit_) {
00022       tsi_.terminate();
00023     }
00024     // 
00025     if (numThreads >= 1) {
00026       tsi_.initialize(numThreads);
00027     }
00028     else {
00029       tsi_.initialize(tbb::task_scheduler_init::automatic);
00030     }
00031   }
00032 
00033   TBBNode::~TBBNode() {}
00034 
00035 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends