Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parallelization feature #4

Open
christophfroehlich opened this issue Dec 13, 2021 · 1 comment
Open

Add parallelization feature #4

christophfroehlich opened this issue Dec 13, 2021 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@christophfroehlich
Copy link
Contributor

The dispersion analysis, basically a monte-carlo simulation, is predestinated for parallelization.

How could one implement this within this python/java framework?
Maybe https://docs.python.org/3/library/multiprocessing.html would do the job.

@christophfroehlich christophfroehlich added help wanted Extra attention is needed enhancement New feature or request labels Dec 13, 2021
@christophfroehlich
Copy link
Contributor Author

christophfroehlich commented Dec 21, 2021

I played a little bit with Multiprocessing and concurrent.futures.

I got to the point

TypeError: cannot pickle '_jpype._JPackage' object

which means that I cannot run more than one simulation with the same orh instance. There is a pickle support of jpype, but I've no glue how to start with it.. jpype-project/jpype#533

Trying to create more than one instance of orhelper.OpenRocketInstance() gives

File "....\ortools\lib\site-packages\orhelper_orhelper.py", line 50, in enter
jpype.startJVM(jvm_path, "-ea", f"-Djava.class.path={self.jar_path}")
File "....\ortools\lib\site-packages\jpype_core.py", line 177, in startJVM
raise OSError('JVM cannot be restarted')

It seems to be impossible to launch the JVM (i.e., orhelper.OpenRocketInstance()) more than once within the same python script: jpype-project/jpype#959

@PatrickKa Any ideas how to overcome this?

Maybe we can duplicate the jar file and load two orhelper for different files. But for creating more than one OR-jar file we would have to adapt orhelper, because the jar file is hardcoded:
https://github.com/SilentSys/orhelper/blob/bc240170b8fde9077c7e4ab6cd2aa01ace142a36/orhelper/_orhelper.py#L14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant