I want to parallelize some program using places, so actually using multiple cores.
To parallelize as much as possible on any given machine, I'd like to know how many cores + effect of hyperthreading there are. For example I have a CPU with 2 cores, but it supports hyperthreading, so that I can run 4 processes concurrently. The desired result would then be 4 instead of 2. At the moment I have the following code, but don't know if this code is at all reliable or a good practice: ~~~ (require cpuinfo) (define (get-number-parallel-units) (define (find-siblings remaining-core-info) (cond [(empty? remaining-core-info) empty] [(equal? (car (first remaining-core-info)) 'siblings) (string->number (cdr (first remaining-core-info)))] [else (displayln "not:") (displayln (car (first remaining-core-info))) (find-siblings (rest remaining-core-info))])) (find-siblings (car (get-cpuinfo)))) ~~~ Then with the number of possible maximum number of concurrent processes, I want to dynamically create places: ~~~ (let ;; dynamically create places ([places (for/list ([i (in-range PLACES-COUNT)]) (dynamic-place "place-worker.rkt" 'place-main))] [chunk-size (/ MAX PLACES-COUNT)]) ;; give places work to do ... ) ~~~ So what is the best and most reliable way to figure out how many processes can run concurrently? (I assume that is the same number as "How many places are worth it?") -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.