#include <amsculib3/amsculib3.hpp>

namespace amscuda
{
namespace util
{

    int amscpu_cputhreading_threadplan(int probsize)
    {
        int nthreads = 1;
        int ta = std::thread::hardware_concurrency();

        if(probsize>1024)
        {
            nthreads = probsize/1024;
            
            if(nthreads>ta-2) nthreads = ta-2;
            if(nthreads>amscuda::amscu_defcputhreads) nthreads = amscuda::amscu_defcputhreads;
            if(nthreads<1) nthreads = 1;
        }

        return nthreads;
    }

};
};