Contains two Java-GEMSEO interfaces:
One is based on JNIUS (https://pyjnius.readthedocs.io/en/stable) to call a Java implementation from a standard Python GEMSEO scenario.
The other is based on JEP (https://github.com/ninia/je) to make a Java code create and use a GEMSEO scenario, eventually containing GEMSEO disciplines implemented in Java.
Installation
Set JAVA_HOME: path to the root installation directory of the Java JDK.
Install with:
pip install .
At runtime, you shall configure:
On linux, LD_LIBRARY_PATH: add the path to the JEP python package,
On MacOS, DYLD_LIBRARY_PATH: add the path to the JEP python package,
On Windows, PATH: add the path to the JEP python package,
CLASSPATH: add the jep package provided when installing jep in the Python distribution to the java classpassth,
See the JEP (https://github.com/ninia/jep/wiki/Getting-Started) documentations for further information.
Java MDODiscipline
The Java abstract MDODiscipline is defined in the package com.irt.saintexupery.discipline.
Examples for the Sellar problem: com.irt.saintexupery.problems.sellar
The analytical derivatives (gemseo.discipline.MDODiscipline._compute_jacobian) are not supported yet.
JEP specific issues
For the JEP interface, you shall wrap the MDODiscipline wrapper using the JepMDODisciplineAdapter:
import com.irt.saintexupery.discipline.JepMDODisciplineAdapter;
import com.irt.saintexupery.problems.sellar.Sellar1;
MDODiscipline sellar1 = new JepMDODisciplineAdapter(new Sellar1());
Examples
Please look at examples/java_examples and examples/python_examples.
Frequent issues
“Exception in thread “main” java.lang.UnsatisfiedLinkError: no jep in java.library.path:” Add Jep to the classpath.
If Jep is still undetected, please check that the compiled “jep.dll” is well included as a native library.
Some ideas on Java-Python bridge technologies
Many libraries provide Java-Python interprocess communications and serialization. However many of them have limitations such as Jython that does not support all the compiled extensions of Python because it is a re-implementation of the Python interpreter in Java. Others use sockets such as py4j and this can deal with performance and security issues.
Both JNIUS and JEP are based on the C APIs of CPython and Java JNI (Java Native Interface). This avoids memory copies, so precision and performance losses, which is key for numerical computing.
JNIUS allows to call Java code from python, JEP allows to call Python from Java, and re-enter in the Java code. However both technologies cannot be mixed, JEP cannot call JNIUS code.
This is why the two solutions are proposed here.
License
LGPL v3.0
Metadata
Release files for gemseo-java 1.0.0.post0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gemseo-java-1.0.0.post0.tar.gz | 44.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gemseo_java-1.0.0.post0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 53.6 kB
Release files / gemseo-java-1.0.0.post0.tar.gz
| Download URL | gemseo-java-1.0.0.post0.tar.gz |
|---|---|
| Size | 44.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
685e9214a5aa993cf109d8bc63cfd0b5be1838567d0202b5f371971943fcc11f
|
|
BLAKE2b-256 checksum How to use checksums |
da7876c8c3baa411c338524ea06517857ff8cfe2428418274d737cf144db0a41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / gemseo_java-1.0.0.post0-py3-none-any.whl
| Download URL | gemseo_java-1.0.0.post0-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5a861152685289d183d477b18aeba89667da52e52a07b6f7559e3854d91e1ac
|
|
BLAKE2b-256 checksum How to use checksums |
fc1b5465dcf30ab427b48c8bb2e3243f4cb247eea55acc011e25a42523fc513e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|