NREL's FASTSim with Numba out soon

In the next few days, the National Renewable Energy Lab (NREL) will be releasing a big update to our FASTSim vehicle powertrain simulation python software that includes extensive use of jitclass. Before that release, if anyone is curious to try it out and/or offer feedback on how Numba is used, if you provide a user name, I can invite you to view the private repo. We’ve gotten a ~50x speedup from Numba, and we’re running hundreds of thousands of sweeps of vehicle drive cycles on our HPC systems. I think this code will also provide a great open source trove of examples of how extensively Numba can be employed to speed up python code.

interesting, thanks for sharing. jitclass cannot be pickled, wasn’t that a problem for parallel calculations?

It seems that after JIT compilation, parallelization works fine, but I have not found any method to get the compilation to persist from one python session to the next. I’ve been using it with PyMoo.

@luk-f-a, I am now seeing that parallelization with multiprocessing.Pool seems to fail because of the error you mentioned above. Got any ideas for how to workaround this?

I don’t know any workarounds. There’s a new structure type, added recently:

I think that one can be pickled, but I haven’t used it yet.

Numba supports nogil mode, in which you can use plain python Threads and get multicore support, might just work for you.

(plain threads share memory so things need not be pickled)

P.S. github username - devxpy


I’ve added you to the github FASTSim repo. I’d also like to request that you fill out the form at so we can collect information about our user base.

Let me know what you think of the code!

@calbaker, thanks for sharing this. Numba 0.52 (upcoming release) contains a few things that could help get more performance in your jitclass heavy use case, the Numba core developers would be interested in feedback if anything noticeable appears. Many Thanks :slight_smile:

1 Like

@stuartarchibald, sounds great! I’ll keep you posted. I’d also like to encourage your team to reference FASTSim’s extensive use of jitclass for people who would like to see more examples of how it can be used. In particular, I think it provides numerous valuable examples of how inheritance in regular python classes can be used to emulate inheritance in jitclasses.

@calbaker I am curious to try it out. I haven’t used @jitclass extensively before.
GitHub username - animator

@calbaker I am interested too. user name: rpopovici

Count me as interested @calbaker. My github un is ryan-chien. BR.

@animator and @rpopovici it has been publicly released at You can download it there. Read the file. We put some effort into it!

1 Like

@ryanchien, see above

1 Like

@stuartarchibald, I’m pretty excited about

Support for heterogeneous immutable lists and heterogeneous immutable string key dictionaries. Also optional initial/construction value capturing for all lists and dictionaries containing literal values (Stuart Archibald).

This could simplify some of our data structures.

@calbaker that was 0.51.x :slight_smile:, would be interested in hearing what uses you find for them. The CHANGELOG for the upcoming 0.52.0RC1 is here if anyone is interested.

@stuartarchibald, I’ll try to figure out how to use the heterogeneous string key dictionaries.

One thing that would be extremely valuable is the ability to persist JIT-compiled classes through python sessions. As best as I can tell, there’s not a mechanism for doing that with jitclass. Let me know if I’ve missed anything.