Conversation
std/parallelism.d
Outdated
| foreach (i; 0..1_000_000) {} | ||
| } | ||
| // Get around weird bugs having to do w/ sqrt being an intrinsic: | ||
| //real[][] sqrtMatrix = poolInstance.amap!parallelSqrt(matrix); |
There was a problem hiding this comment.
amap can not call parallelSqrt that that local function was trying to access poolInstance which is located on the same stack
322ddd1 to
67e0411
Compare
std/parallelism.d
Outdated
| ) | ||
| ); | ||
| // Get around weird bugs having to do w/ sqrt being an intrinsic: | ||
| real[][] sqrtMatrix = poolInstance.amap!parallelSqrt(matrix); |
There was a problem hiding this comment.
amap can not call parallelSqrt that that local function was trying to access poolInstance which is located on the same stack
|
Well, it is a stress test, but yeah, probably nobody was running it and it's better to have it run once like this by the tester, so it's kept up to date. |
std/parallelism.d
Outdated
| assert(poolInstance.workerIndex() == 0); | ||
| // These unittests are intended more for actual testing and not so much | ||
| // as examples. | ||
| void stressTest2(int poolSize) |
There was a problem hiding this comment.
Huh - what was the reason to expose such test methods publicly?
Shouldn't they be private and have version(unittest)?
There was a problem hiding this comment.
I created this function to have runnable one or multiple times. Eventually, this will be private. But this is not the problem here. Please keep the nitpicking to a minimum for now.
|
@joakim-noah not only that but the design concept used by the test is no longer supported by D. Which begs the question if std.parallelism is still a working phobos module or if it needs to be deprecated. |
| { | ||
| static import std.math; | ||
| return std.math.isNaN(f); | ||
| } |
There was a problem hiding this comment.
I thought so to, but isNaN was passed as a function to a function of parallelism. But this code has not been run at least since isNaN became a template. This is just code trying to get the tests into a compileable state.
std/parallelism.d
Outdated
| // matrix. | ||
| static real[] parallelSqrt(real[] nums) | ||
| { | ||
| return poolInstance.amap!(mySqrt)(nums); |
There was a problem hiding this comment.
Your first problem is that static functions aren't allowed to access poolInstance
|
Before being quite so fatalistic and going around suggesting modules to be deprecated, you might want to make sure which of the issues actually existed before you touched the code. |
67e0411 to
b60c33b
Compare
|
@klickverbot I recreated your PR here. The difference is that I moved the two unittests into a function that takes the number of runs as an argument. Now I get: std/parallelism.d(4467): Error: static function std.parallelism.testFunction2.parallelSqrt cannot access frame of function std.parallelism.testFunction2 I really could need some help. I do not see the problem. |
As I said in my earlier comment, it means exactly what it says: you're trying to get a variable that belongs to |
|
std/parallelism.d(4467): Error: template instance amap!(mySqrt) cannot use local 'mySqrt' as parameter to non-global template amap(functions...) IMO the problem is that unittest block statements are somehow different from function block statements. And the test/use-case of std.parallelism used that fact. |
|
If you keep it using the global |
|
Ping @burner |
|
I hadn't had much time lately. But its on my list |
|
Hmm we should really enable the test suite. There's some random (un)-coverage business going on in at least these places of |
Big parts of the std.parallelism unittests where not run for a very long time.
Apparently they do not even compile anymore. This PR refactors the unittests
so they are at least run once by default. While refactoring I found a couple of
problems with the unittests. Such as, local unittest function being unable to
access the current stackframe. This destroyed some constructs used by
std.parallelism.
I'm a noob when it comes to std.parallelism. I found this bug while scoping
imports. I need help on this!