Hi Tom,

On Sep 15, 2014, at 7:07 AM, Tom Browder wrote:

> I have a program that uses librt for ray tracing and I would like to
> have the option to use just one cpu.  (I'm currently using version
> 7.24.2.)
> 
> I have looked at the functions I explicitly use and see there is a
> func arg for the number of cpus and I have them set to 1.  However, my
> coworker is processing a large tgm and has trouble killing the using
> program and suspects multiple cpus are being used.

If you specify ncpus==1 to any of the functions that run in parallel, it should 
be respecting that value and any deviation would be a pretty significant 
unintentional bug.  I'm not aware (nor on quick search can find) of any library 
function call that unilaterally decides to create multiple threads by default.

Are you using any of the following:

1) ged_gqa()?
2) photon mapping?
3) lgt or rt via a script?
4) is it brep/nurbs geometry?
5) actually trunk and not 7.24.2?

> Is there a global I can set to ensure only 1 cpu is used for BRL-CAD
> library functions?

There are several ways.  The strictest way possible, which I don't recommend 
for production use but is often most useful for debugging, is to forcibly turn 
off all parallelism during compilation so there is little doubt.  This is done 
by adding the -DBRLCAD_ENABLE_SMP=NO during CMake.  All parallelism in BRL-CAD 
is toggled with a single PARALLEL preprocessor symbol, which that cmake option 
sets to false.

There is a global, but it only affects ray-tracing applications, not 
applications accessing the lower-level parallelism interface directly.  It's 
the rtg_parallel flag in the rt_g / RTG global (recently renamed), but I'd 
consider that a last resort that might not even work (and is unpublished, 
subject to change, yada yada).  If this is something periodically needed, 
someone could implement a LIBBU_PARALLEL environment variable override.

Can you confirm that it's actually running in parallel?

If it's not obvious with the top command, you can attach to the process with 
gdb and ask it how many threads.  Just run "gdb" and then "attach PID" on the 
gdb prompt.  It will pause the application and let you inspect it.  The "info 
threads" command will report a line for every thread and let you know how many 
are running.

Yet another method is a bu_debug global that can be set to 0x10 (see 
include/bu/debug.h) which will print debugging statements regarding parallelism.

Cheers!
Sean



------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to