[Spice_discussion] SPICE and multi-threading? (Ed Wright (JPL))

Andrew S. Gardner asg at lpl.arizona.edu
Wed Oct 1 11:59:10 PDT 2014

We do lots of batch processing using SPICE and have two tools to get
around the single-threaded problem.

First, we create a database that sorts all of the various kernels by
valid time and then we can query it to create kernel lists based on
time, e.g. kl -f 2014-01-01-00:00:00 -t 2014-01-02-00:00:00, which
queries the list of valid kernels for January 1, 2014.  This makes it
possible to split all of the processing into reasonable ranges, but we
seem to always end up doing UTC days.

Second, our code that calls SPICE can knows about time slices, too. We
either spawn many, many processes from a cluster manager, e.g. torque,
or let a process set up multiple time ranges, _fork_, and then load
kernels in each child process.

Andrew S. Gardner
asg at lpl.arizona.edu
Voice and SMS: 520-275-2148

>> Has anyone on the list used SPICE in a multi-core, multi-thread
>> environment?  Basically calling SPICE in multiple threads sharing
>> the same memory on a multi-core processor(s).
>> I?ve tried this launching multiple instances of python-wrapped SPICE
>> for the case where I?m retrieving position snapshots of the same set
>> of spacecraft and planets, but at multiple times (for generating
>> animations).  The results were inconsistent and I switched back to
>> single thread operation.
>> If SPICE is thread-safe, then I?ve probably done something wrong
>> (perhaps not completely initializing or closing SPICE for each
>> thread?)
>> Are there any guidelines available?
>> Thanks,
>> Tom
>> --
>> Dr. William T."Tom" Bridgman               Scientific Visualization
>> Studio
>> Global Science & Technology, Inc.          NASA/Goddard Space Flight
>> Center
> SPICE (all language versions) is in no way thread safe and cannot be
> made so without a major redesign and recoding.

More information about the Spice_discussion mailing list