ngal | A simple C Genetic Algorithm Library | Machine Learning library
kandi X-RAY | ngal Summary
kandi X-RAY | ngal Summary
A C++ genetic algorithm library. This code is super old and likely of little use to anyone, however it was an indication that at some point in my life I actually knew a little bit more about C++ than I do now, and I'd like to remember that fact for later on when I've lost all comprehension of it again. If this is of any use to you, let me know.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ngal
ngal Key Features
ngal Examples and Code Snippets
Community Discussions
Trending Discussions on ngal
QUESTION
I want to parallelize a piece of code that resembles the following:
...ANSWER
Answered 2020-Mar-27 at 21:27The first issue I see is that you are creating a global variable gal which is being accessed by the function deltaz. These are however not shared between the pool processes but instantiated for each process separately. You will have to use shared memory if you want them to share this structure. This is probably why you see a non-deterministic behavior.
The next issue is that you are not actually completing the same tasking with the different variation. The first one you are taking an average of each set of averages (gal). The parallel one is taking an average of which ever elements happen to end up in that list. This is nondeterministic because items are assigned to processes as they become available and this is not necessarily predictable.
I would suggest parallelizing the inner loop. To do this, you need zt and samples to both be in shared memory because they are accessed by all of the processes. This can get dangerous if you are modifying data but since you appear to only be reading it should be fine.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ngal
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page