Home Computing Teaching Bushcraft Games Writing About
Why I love my job
One of my students came in and asked me this :
So I realize this question sounds stupid (and yes I am using a dual core), but I have tried two different libraries (Grand Central Dispatch and OpenMP), and when using clock() to time the code with and without the lines that make it parallel, the speed is the same. (for the record they were both using their own form of parallel for). They report being run on different threads, but perhaps they are running on the same core? Is there any way to check? (Both libraries are for C, I’m uncomfortable at lower layers.) This is super weird. Any ideas?
I told him this smells like a problem with the tool he is using to measure clock speeds, and perhaps an issue with the scheduler. He posted this question here and sure enough, clock() isn’t the best way to measure code execution speed.
This kid is 14 years old.
I love this stuff.