get_number_threads

C++ Function Reference

1 Signature

unsigned int get_number_threads(Rcpp::Nullable< int > threads, Rcpp::Nullable< bool > bparal)

2 Parameters

  • threads (Rcpp::Nullable< int >)
  • bparal (Rcpp::Nullable< bool >)

3 Returns

Type: unsigned int

4 Call Graph

Function dependencies

5 Source Code

File: inst/include/Utilities/openme-utils.hppLines 277-298

inline unsigned int get_number_threads(Rcpp::Nullable<int> threads, Rcpp::Nullable<bool> bparal) {
        
        // unsigned int ithreads = std::thread::hardware_concurrency();
        unsigned int ithreads = getDTthreads(INT_MAX, false);
        
        if( bparal.isNotNull() ) {
            if(Rcpp::as<bool>(bparal) == false) {
                ithreads = 1;
                return(ithreads);
            }
        }
        
        if(threads.isNotNull()) {
            if (Rcpp::as<int> (threads) <= (int)ithreads){
                ithreads = Rcpp::as<int> (threads);
            }
        } else {
            ithreads =  getDTthreads(0, false);
        }    
        
        return(ithreads);
    }

6 Usage Example

#include "BigDataStatMeth.hpp"

// Example usage
auto result = get_number_threads(...);