Bill MacKenty

 
 
 

Why I love my job

Posted in Teaching Diary on 12 - March 2010 at 04:19 PM (12 years ago). 13 views.

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.