Menu
Logged-In As
ACCOUNTNot Logged In
Implement thread creation for WindowsBRL-CAD
Status: ClosedTime to complete:
48 hrs
Mentors: Sean, Daniel Rossberg
BRL-CAD implements support for running in parallel on computers with multiple CPUs or cores. However, there are lots of ways to run in parallel. BRL-CAD runs on Windows, but presently only in a single-threaded mode. To make it work in parallel, we need to define how threads are created. This task involves implementing the necessary logic to create a new thread in bu_parallel(). This requires a very minor source code modification to just one file, but make sure it works with a simple test program. Make your program call bu_parallel(), see include/bu.h for API docs. References:
Code:
|
Uploaded Work
File name/URL | File size | Date submitted | |
---|---|---|---|
parallel.c | 28.6 KB | December 04 2012 15:25 UTC | |
Win32threads.patch | 2.0 KB | December 04 2012 17:21 UTC | |
BRL-CADThreads.patch | 1.4 KB | December 05 2012 14:31 UTC | |
ThirdPatch.patch | 1.3 KB | December 05 2012 15:01 UTC | |
Thread.patch | 1.1 KB | December 05 2012 18:33 UTC | |
WThread.patch | 1.7 KB | December 06 2012 10:59 UTC | |
Thread2.patch | 1.6 KB | December 06 2012 14:44 UTC | |
Thread3.patch | 1.5 KB | December 06 2012 16:47 UTC |
I would like to work on this task.
This task has been assigned to Adrián Arroyo Calle. You have 48 hours to complete this task, good luck!
I submited a new file. Check the file and tell me the errors. Thanks in advance.
and take our coding conventions into account (the HACKING file).
I read the HACKING file and I change some of this { }. I create a patch file and the program will work
The work on this task is ready to be reviewed.
Adrián, that's looking good but I noticed a few problems. The biggest is that you need to wait for all threads to complete before allowing the bu_parallel() function to return. Something similar to pthread_join(). See the other sections for examples.
Another problem is the formatting is a terrible mess! :) Your indentation doesn't follow our coding style (please read our HACKING file). Indentation needs to be pristine and matching the rest of the file. Indents should be 4 char, 1 tab, 1 tab + 4 char, 2 tab, 2 tab + 4 char, etc. There shouldn't be a slew of empty blank lines, there shouldn't be XXX comments for new code. Formatting isn't just nice to have -- it's just as important as the code itself so please work to get it right.
Finally, what are the pDataArray values supposed to mean? I see the first is the cpu number, but why is the second incremented by 100?
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The work on this task is ready to be reviewed.
I submited a new patch including the pthread_join() equivalent in WinAPI. I also change some of the coding style and the pDataArray is only a number for create the thread. So, I'm ready for review
The ThirdPatch.patch file is not a valid patch file. Also, the changes still do not conform to our coding style. The indentation is wrong and you still have a slew of superfluous blank lines being added. That's obvious without even applying the file just by reading the patch file.
Since this is apparently something you're having difficulty seeing, perhaps you may want to try using automatic formatting. This extension to visual studio might help you:
http://code.google.com/p/extabsettings/
It should also go without saying, but given the other issues ... have you made sure that your patch compiles cleanly?
Last, you didn't answer my question about pDataArray. I know it's a number for creating the thread, what does the number mean? What is it used for? Why is it 100 greater than the CPU id? Magic numbers must be documented with a comment, you need to say what that '100' is for or what that field in the array is for in more detail.
I submited a new patch file, I check it ThirdPatch.patch and now I know the character limit in filename. I change the tabs (thanks for the add-in) and I delete blank lines. I tested the patch in small program like the task says: but make sure it works with a simple test program. My small program calls a function declared like parallel_interface(), it works on Win32 and Win64. The pDataArray was an error, because the Microsoft code has arguments. I removed it.
The format of your file is still not a valid patch file. How are you making that file?? If you have a subversion client, it will generate the patch file for you. Also, the indentation is still wrong -- your file has tabs on the first indent, which should be four spaces.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The deadline of the task has been extended with 0 days and 12 hours.
The work on this task is ready to be reviewed.
The tool for creating patch on Windows needs some arguments, but now the patch is valid. I re-write the spaces and I think that now are good. Thanks for more time (in Spain today is a non-working day).
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The work on this task is ready to be reviewed.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The work on this task is ready to be reviewed.
Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.
Now that's looking like a proper patch! I haven't tested whether it actually compiles, but the patch applied cleanly. There were STILL three problems with the patch including an outright syntax error, so it certainly doesn't compile in its latest final form. Other problems were trailing whitespace, ifdef/endif indenation was wrong, and you were missing a semicolon(!).
Still, you've put reasonable efffort in. I have credited your contribution in our authorship documentation and you'll be included in a future release announcement. We'll be creating another task to properly test this change that you might want to keep an eye out for.
Congratulations, this task has been completed successfully.
A follow-on task has been posted:
http://www.google-melange.com/gci/task/view/google/gci2012/8086204
As GCI comes to a close, we wanted to take the time to say THANK YOU for all your efforts. This comment interface closes after GCI is over, so you're encouraged to join our mailing list where we'll be announcing contributions from GCI participants like yourelf over the upcoming months:
https://lists.sourceforge.net/lists/listinfo/brlcad-news
If you've provided your full name, we'll be sure to credit you in our authorship documentation and you'll see your name in a future announcement. If you contact us at devs@brlcad.org or via IRC, we'll even let you know when your work is integrated and follow up with updates. You're welcome and encouraged to contact us any time, especially if you have a question about how to continue participating in Open Source after GCI is over, but even if just to keep in touch. Note that ongoing participation in Open Source is one of the most impressive skills to have on your resumé. Take care, be well, and thank you again!