Jump to content

System and implementation specific - which means it can return anything.

A system can support multiple threads per processing unit, or access to (some) processing units can be denied to your program by the OS so the result need not match the amount of cores in your CPU.

Link to post
Share on other sites

2 hours ago, zMeul said:

Return value

number of concurrent threads supported

 

it should return 8, test it

I can't test it, as I don't have a hyper-threaded CPU... But thanks!

Nothing to see here ;)

Link to post
Share on other sites

The results as expected with an i7-5820k. However std::thread::hardware_concurrency is platform specific and implementation specific meaning that the results can be different across OS's and hardware.

20160707184136364.png

int  main()
{
	std::thread t;

	int numThreads = t.hardware_concurrency();

	std::cout << "Number of Threads: " << numThreads << std::endl;

	std::cin.get();
	return 0;	
}

 

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to post
Share on other sites

6 hours ago, trag1c said:

The results as expected with an i7-5820k. However std::thread::hardware_concurrency is platform specific and implementation specific meaning that the results can be different across OS's and hardware.

20160707184136364.png


int  main()
{
	std::thread t;

	int numThreads = t.hardware_concurrency();

	std::cout << "Number of Threads: " << numThreads << std::endl;

	std::cin.get();
	return 0;	
}

 

Thanks a ton - that was really helpful!

Nothing to see here ;)

Link to post
Share on other sites

2 minutes ago, Anand_Geforce said:

Thanks a ton - that was really helpful!

Happy to help. :)

CPU: Intel i7 - 5820k @ 4.5GHz, Cooler: Corsair H80i, Motherboard: MSI X99S Gaming 7, RAM: Corsair Vengeance LPX 32GB DDR4 2666MHz CL16,

GPU: ASUS GTX 980 Strix, Case: Corsair 900D, PSU: Corsair AX860i 860W, Keyboard: Logitech G19, Mouse: Corsair M95, Storage: Intel 730 Series 480GB SSD, WD 1.5TB Black

Display: BenQ XL2730Z 2560x1440 144Hz

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×