Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » U++ community news and announcements » CoWork::FinLock
Re: CoWork::FinLock [message #45815 is a reply to message #45810] Sun, 10 January 2016 18:10 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3372
Registered: August 2008
Senior Veteran
Hello Mirek

To help with parallel programming in U++ I have uploaded some benchmarks in new package Bazaar/OpenMP_demp. I hope it will happen as positive NTL vs. STL comparison Smile

About storing partial results, it could be interesting to see demo "Pi" at it uses reduction() clause to handle temporary results between cores.

static double pi_device() {
	double x, y;
	long count = 0, i;
	
	// Parallel loop with reduction for calculating PI  
	#pragma omp parallel for private(i, x, y) shared (samples) reduction(+:count) 
	for (i = 0; i < samples; ++i) {
		x = Random(1000000)/1000000.;
		y = Random(1000000)/1000000.;
		if (sqrt(x*x + y*y) < 1)
			count++;
	}
	return 4.0 * count / samples;
}


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Happy New Year 2016
Next Topic: TheIDE - Python syntax and indention support
Goto Forum:
  


Current Time: Mon Jun 17 06:41:11 CEST 2024

Total time taken to generate the page: 0.02425 seconds