Git Product home page Git Product logo

Comments (3)

Acters avatar Acters commented on July 26, 2024 4

your worries of A race condition occurring will only be problematic when two or more threads that can access shared data and try to change it at the same time to different values. This does not need to be a problem as both threads should come to the same conclusion/write the same value.

from is-prime.

Acters avatar Acters commented on July 26, 2024

You can set each core to only handle multiples of each number except for multiples of 1. This way you can cover almost all the numbers. while having one core handle the numbers skipped by your other cores. probable max multithreaded efficiency use case will be to have about 10 cores dedicated to crunching numbers, after that multithreading will be too complicated to work.

This way you have one core handling any missed numbers, then second core handling multiples of 2, third core handling multiples of 3, fourth core handling multiples of 4, …and so on... up to core nine handling multiples of 9. This way all numbers get tested. Unfortunately some numbers will be tested more than once by different cores.

from is-prime.

yoifox avatar yoifox commented on July 26, 2024

cuda implementation uses more than 1000000 threads

from is-prime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.