I need to run a Python script in 32 bit system wide to generate / collect data through a third-party application. But I want to process the data using GPU via numba
, so it has to be run in 64 bit Python environment.
I have set up a 64 bit Python virtualenv
, and testes some simple numba
code that ran fine in there. So how shall I write the code in the parent process that will invoke a child process (multiprocessing
or subprocess
I assume) that will switch to 64 bit virtualenv
and does calculation using numba? More specifically:
- shall I use
multiprocessing
orsubprocess
to implement the parent (32 bit Python) and child process (64 bit Python) mechanism? - how shall I pass large amount of data between the parent and child processes?
possible code sample:
def func_32():
# data collection
# using 3rd party API
return data
def func_64(data, output):
# switch to 64 bit virtual env
# using virtualenvwrapper-win
os.system('workon env64bit')
# numba data process
# results stored in output
return None
def main():
data = func_32()
# I think I only need one process since it will be in GPU not CPU
p = multiprocessing.Process(target=func_64, args=(data, output))
p.start()
return output
anything I'm missing in the sample code?