parallelism-amdahl

Optimisation tips to find in which triangle a point belongs

和自甴很熟 提交于 2021-02-18 17:49:03
问题 I'm actually having some troubles optimising my algorithm: I have a disk (centered in 0, with radius 1) filled with triangles (not necessarily of same area/length). There could be a HUGE amount of triangle (let's say from 1k to 300k triangles) My goal is to find as quick as possible in which triangle a point belongs. The operation has to be repeated a large amount of time (around 10k times ). For now the algorithm I'm using is: I'm computing the barycentric coordinates of the point in each

Negative speed up in Amdahl's law?

删除回忆录丶 提交于 2021-02-02 09:07:51
问题 Amdahl’s law states that a speed up of the entire system is an_old_time / a_new_time where the a_new_time can be represented as ( 1 - f ) + f / s’ , where f is the fraction of the system that is enhanced by some modification, and s’ is the amount by which that fraction of the system is enhanced. However, after solving this equation for s’ , it seems like there are many cases in which s’ is negative, which makes no physical sense. Taking the case that s = 2 (a 100% increase in the speed for

An OpenCL code in MQL5 does not get distributed jobs to each GPU core

做~自己de王妃 提交于 2020-12-05 08:21:47
问题 I have created a GPU based indicator for MetaTrader Terminal platform, using OpenCL and MQL5. I have tried hard that my [ MetaTrader Terminal: Strategy Tester ] optimization job must get transferred on GPU to maximum. Most of the calculations are done by the indicator. Hence, I made changes in the indicator and has completely transferred on GPU. But the real issue arises when I try to go for optimization process in the strategy tester section. The process I see uses both my GPU and CPU but

Poor scaling of multiprocessing Pool.map() on a list of large objects: How to achieve better parallel scaling in python?

别等时光非礼了梦想. 提交于 2020-03-13 06:29:12
问题 Let us define : from multiprocessing import Pool import numpy as np def func(x): for i in range(1000): i**2 return 1 Notice that func() does something and it always returns a small number 1 . Then, I compare an 8-core parallel Pool.map() v/s a serial, python built in, map() n=10**3 a=np.random.random(n).tolist() with Pool(8) as p: %timeit -r1 -n2 p.map(func,a) %timeit -r1 -n2 list(map(func,a)) This gives : 38.4 ms ± 0 ns per loop (mean ± std. dev. of 1 run, 2 loops each) 200 ms ± 0 ns per

Why does joblib.Parallel() take much more time than a non-paralleled computation? Shouldn't Parallel() run faster than a non-paralleled computation?

二次信任 提交于 2019-12-22 15:00:21
问题 A joblib module provides a simple helper class to write parallel for loops using multiprocessing. This code uses a list comprehension to do the job : import time from math import sqrt from joblib import Parallel, delayed start_t = time.time() list_comprehension = [sqrt(i ** 2) for i in range(1000000)] print('list comprehension: {}s'.format(time.time() - start_t)) takes about 0.51s list comprehension: 0.5140271186828613s This code uses joblib.Parallel() constructor : start_t = time.time() list

CyclicDist goes slower on multiple locales

孤者浪人 提交于 2019-12-22 14:48:06
问题 I tried doing an implementation of Matrix multiplication using CyclicDist module. When I test with one locale vs two locales, the one locale is much faster. Is it because the time to communicate between the two Jetson nano boards is really big or is my implementation not taking advantage of the way CyclicDist works? Here is my code: use Random, Time, CyclicDist; var t : Timer; t.start(); config const size = 10; const Space = {1..size, 1..size}; const gridSpace = Space dmapped Cyclic(startIdx

How to find an optimum number of processes in GridSearchCV( …, n_jobs = … )?

拟墨画扇 提交于 2019-12-22 10:40:58
问题 I'm wondering, which is better to use with GridSearchCV( ..., n_jobs = ... ) to pick the best parameter set for a model, n_jobs = -1 or n_jobs with a big number, like n_jobs = 30 ? Based on Sklearn documentation: n_jobs = -1 means that the computation will be dispatched on all the CPUs of the computer. On my PC I have an Intel i3 CPU, which has 2 cores and 4 threads, so does that mean if I set n_jobs = -1 , implicitly it will be equal to n_jobs = 2 ? 回答1: ... does that mean if I set n_jobs =

How can I use more CPU to run my python script

*爱你&永不变心* 提交于 2019-12-19 12:24:12
问题 I want to use more processors to run my code to minimize the running time only. Though I have tried to do it but failed to get the desired result. My code is a very big one that's why I'm giving here a very small and simple code (though it does not need parallel job to run this code) just to know how can I do parallel job in python. Any comments/ suggestions will be highly appreciated. import numpy as np import matplotlib.pyplot as plt from scipy.integrate import odeint def solveit(n,y0): def

Calculate performance gains using Amdahl's Law

不羁的心 提交于 2019-12-12 17:14:21
问题 I am puzzling with Amdahl's Law to determine performance gains and the serial application part and fail to figure out this one. Known is the following: S(N) = Speedup factor for (N) CPU's N = Number of CPU's f = The part of the program which is executed sequential S(N) = N / ( 1 + f * ( N - 1 ) ) If I have 4 CPU's and a speedup factor (performance gain) of 3x. What would f be? My guess: S(N) = 3 (that's our performance gain using 4 CPU's) N = 4 So entering these values in the formula: 3 = 4 /

Why does joblib.Parallel() take much more time than a non-paralleled computation? Shouldn't Parallel() run faster than a non-paralleled computation?

风流意气都作罢 提交于 2019-12-06 07:38:29
A joblib module provides a simple helper class to write parallel for loops using multiprocessing. This code uses a list comprehension to do the job : import time from math import sqrt from joblib import Parallel, delayed start_t = time.time() list_comprehension = [sqrt(i ** 2) for i in range(1000000)] print('list comprehension: {}s'.format(time.time() - start_t)) takes about 0.51s list comprehension: 0.5140271186828613s This code uses joblib.Parallel() constructor : start_t = time.time() list_from_parallel = Parallel(n_jobs=2)(delayed(sqrt)(i ** 2) for i in range(1000000)) print('Parallel: {}s