Skip to content

Commit

Permalink
Rename app to pymerlin and add instructions for building jar
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdailis committed Jul 1, 2024
1 parent 51d0bf5 commit 06c0bb6
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 5 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
A python modeling framework for Aerie.

### TODO:

- [ ] Daemon tasks
- [ ] More interesting cells and resources
- [x] Conditions on discrete cells
Expand All @@ -14,6 +15,7 @@ A python modeling framework for Aerie.
- [ ] build Aerie-compatible jars and provide docker-compose file with python

## Prerequisites

- python >=3.6.3 (only tested on 3.12 so far...)
- java >=21

Expand All @@ -24,20 +26,30 @@ A python modeling framework for Aerie.
3. Install requirements `python -m pip install -r requirements.txt`
4. Start jupyter lab `jupyter-lab`
5. When jupyter opens, navigate to `demo/simulation_example.py`
6. Update the path in the first cell to point to your cloned `pymerlin` directory (we should eliminate the need for this hack)
6. Update the path in the first cell to point to your cloned `pymerlin` directory (we should eliminate the need for this
hack)
7. Run all cells

## Architecture

pymerlin is to merlin as pyspark is to spark. This means that pymerlin uses [py4j](https://www.py4j.org/) as a bridge
between a python process and a java process. This allows pymerlin to use the Aerie simulation engine directly, without
having to re-implement it in python.

This means that running `simulate` starts a subprocess using `java -jar /path/to/pymerlin.jar`.


### Approachability over performance

The main tenet of pymerlin is approachability, and its aim is to enable rapid prototyping of models and activities.
While where possible, performance will be considered, it is expected that someone who wants to seriously engineer the
performance of their simulation will port their code to Java - which has the double benefit of removing socket
communication overhead, as well as giving the engineer a single Java process to instrument and analyze, rather than a
hybrid system, which may be more difficult to characterize.
communication overhead, as well as giving the engineer a single Java process to instrument and analyze, rather than a
hybrid system, which may be more difficult to characterize.

## Building pymerlin.jar

```shell
cd java
./gradlew assemble
mv pymerlin/build/libs/pymerlin.jar ..
```
1 change: 1 addition & 0 deletions java/app/build.gradle → java/pymerlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dependencies {
}

jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes(
'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' '),
Expand Down
2 changes: 1 addition & 1 deletion java/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ plugins {
}

rootProject.name = 'java'
include('app')
include('pymerlin')
Binary file modified pymerlin.jar
Binary file not shown.

0 comments on commit 06c0bb6

Please sign in to comment.