Profile NURBS prep performanceBRL-CAD
Status: ClosedTime to complete: 100 hrs Mentors: Isaac Kamga, Kesha ShahTags: profiling, testing, performance, quality assurance, profile

BRL-CAD implements support for rendering of NURBS representation geometry. If you import a solid 3DM or STEP format model into BRL-CAD, it will import as BREP/NURBS geometry. Opening that geometry in BRL-CAD's MGED editor will tell you what objects are available and our 'rt' tool will raytrace it. When geometry is ray traced, it first goes through a ''prep'' phase and then it starts shooting rays. Our prep phase is entirely unoptimized so we'd like to know where all the time is presently being spent during prep..

This task involves importing some NURBS geometry into BRL-CAD and ray tracing that geometry with a profiler watching our prep performance. Any profiler will do, including gprof, but a performance monitor like oprofile or the Mac ''Instruments'' application (or Shark) are preferred.

Learning how to use a profiler is beyond the scope of this task, so it make take you considerably longer to provide us with useful information if you've never run a profiler before.

To capture prep performance, you will need to import some fairly complex geometry. You should be able to search google with ''filetype:3dm'' or ''filetype:step'' or find something on grabcad.com to import

Running ''tops'' within mged will tell you what geometry is available for rendering.

Running ''rt -o file.png -s32'' on the system command line (not inside mged) should minimize the ray overhead or you can specifically isolate the prep phase we care about. Prep is the time between when rt is run where it opens a window until the first pixels are fired and pixels start filling in.

Uploaded Work
File name/URLFile sizeDate submitted
perf.data-normal5.3 MBDecember 18 2014 02:40 UTC
perf.data-callgraph.gz3.8 MBDecember 18 2014 02:41 UTC
brlcad-rt-prep-callgraph.svg224.3 KBDecember 18 2014 02:41 UTC
rt_prep.c282 bytesDecember 18 2014 02:42 UTC
nurbs_tests.g3.2 MBDecember 18 2014 02:43 UTC
Comments
Andromeda Galaxyon December 17 2014 20:56 UTCTask Claimed

I would like to work on this task.

Sean on December 18 2014 02:35 UTCTask Assigned

This task has been assigned to Andromeda Galaxy. You have 100 hours to complete this task, good luck!

Andromeda Galaxyon December 18 2014 02:42 UTCReady for review

The work on this task is ready to be reviewed.

Andromeda Galaxyon December 18 2014 02:47 UTCFiles

I compiled rt_prep.c and used the resultant executable to (mostly) isolate the prep phase. I used nurbs_tests.g as the test database: since I had trouble finding good complex NURBS geometry, I used these basic ones that d_rossberg pointed me at, cloned a number of times to increase the runtime of prep, and, therefore, the amount of data collected by the statistical profiler.


For profiling, I used the linux `perf' tool --- somewhat similar to oprofile for this use case --- and generated one ``basic'' perf data file that just shows the total amount of time spent in each function by itself (perf.data-normal) as well as one that includes a call graph (perf.data-callgraph.gz, gzipped because otherwise it wouldn't fit in Melange's file size limit).  Finally, brlcad-rt-prep-callgraph.svg is a rendering of the call graph prepared by the gprof2dot tool.

Sean on December 18 2014 03:15 UTCTask Closed

Congratulations, this task has been completed successfully.

Sean on December 18 2014 03:16 UTCnice work!

Very comprehensive, nicely done!  Thanks for going above and beyond too, providing the gprof2dot tool -- very useful visualization.