-
Notifications
You must be signed in to change notification settings - Fork 7
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
WIP: Support for running tutorials using Docker #6
Open
activeshadow
wants to merge
1
commit into
GMLC-TDC:main
Choose a base branch
from
activeshadow:docker
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
build: | ||
$(MAKE) -C helics build | ||
$(MAKE) -C griddyn build | ||
$(MAKE) -C gridlab-d build | ||
$(MAKE) -C psst build | ||
$(MAKE) -C runner build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Dockerfiles | ||
|
||
A Dockerfile exists for each component (ie. federate) needed for the | ||
tutorials. The Docker Compose files for each tutorials will reference | ||
the relevant Dockerfiles as the `build` argument for each container. | ||
Alternatively, each image can be built by running `make build` in the | ||
relevant directory, or all the images can be built by running `make | ||
build` in this directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
FROM helics as builder | ||
|
||
RUN apt update && apt install -y \ | ||
libboost-dev libboost-chrono-dev \ | ||
libboost-date-time-dev libboost-filesystem-dev \ | ||
libboost-program-options-dev \ | ||
libboost-system-dev libboost-test-dev \ | ||
libboost-timer-dev libsuitesparse-dev \ | ||
libzmq3-dev libklu1 \ | ||
build-essential cmake git | ||
|
||
WORKDIR /root/develop | ||
|
||
RUN git clone --single-branch -b cmake_update https://github.com/LLNL/GridDyn.git | ||
|
||
WORKDIR /root/develop/GridDyn | ||
|
||
ADD fmi-patch.diff . | ||
RUN git apply fmi-patch.diff | ||
|
||
WORKDIR /root/develop/GridDyn/build | ||
|
||
RUN cmake -DHELICS_EXECUTABLE=ON .. && make -j8 install | ||
|
||
FROM ubuntu:18.04 | ||
|
||
RUN apt update && apt install -y --no-install-recommends \ | ||
libboost-chrono1.65.1 libboost-date-time1.65.1 \ | ||
libboost-filesystem1.65.1 libboost-program-options1.65.1 \ | ||
libboost-system1.65.1 libboost-test1.65.1 \ | ||
libboost-timer1.65.1 libzmq5 libklu1 libgomp1 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /usr/local /usr/local/ | ||
|
||
# FIXME | ||
CMD ["gridDynMain", "--version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
NAME := griddyn | ||
|
||
build: | ||
docker build -t $(NAME) . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/src/fmi/CMakeLists.txt b/src/fmi/CMakeLists.txt | ||
index 63f35f7..4ffd693 100644 | ||
--- a/src/fmi/CMakeLists.txt | ||
+++ b/src/fmi/CMakeLists.txt | ||
@@ -78,7 +78,7 @@ source_group("FMUImport" FILES ${fmiImport_sources} ${fmiImport_headers}) | ||
|
||
set_target_properties(fmiGDLibrary PROPERTIES FOLDER fmi) | ||
|
||
-target_link_libraries(fmiGDLibrary griddyn formatInterpreter) | ||
+target_link_libraries(fmiGDLibrary griddyn formatInterpreter ${CMAKE_DL_LIBS}) | ||
|
||
install( | ||
TARGETS fmiGDLibrary | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM helics as builder | ||
|
||
RUN apt update && apt install -y \ | ||
libboost-dev libboost-chrono-dev \ | ||
libboost-date-time-dev libboost-filesystem-dev \ | ||
libboost-program-options-dev \ | ||
libboost-test-dev libboost-timer-dev \ | ||
libzmq3-dev libtool libxerces-c-dev \ | ||
build-essential automake git | ||
|
||
|
||
WORKDIR /root/develop | ||
|
||
RUN git clone --single-branch -b develop https://github.com/gridlab-d/gridlab-d.git | ||
|
||
WORKDIR /root/develop/gridlab-d | ||
|
||
RUN autoreconf -if \ | ||
&& ./configure --prefix=/usr/local --with-helics=/usr/local --enable-silent-rules \ | ||
"CFLAGS=-g -O0 -w" "CXXFLAGS=-g -O0 -w -std=c++14" "LDFLAGS=-g -O0 -w" \ | ||
&& make -j8 install | ||
|
||
FROM ubuntu:18.04 | ||
|
||
RUN apt update && apt install -y --no-install-recommends \ | ||
libboost-chrono1.65.1 libboost-date-time1.65.1 \ | ||
libboost-filesystem1.65.1 libboost-program-options1.65.1 \ | ||
libboost-test1.65.1 libboost-timer1.65.1 \ | ||
libzmq5 libxerces-c3.2 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /usr/local /usr/local/ | ||
|
||
ENV LD_LIBRARY_PATH=/usr/local/lib | ||
|
||
CMD ["gridlabd", "--version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
NAME := gridlab-d | ||
|
||
build: | ||
docker build -t $(NAME) . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
FROM ubuntu:18.04 as builder | ||
|
||
RUN apt update && apt install -y \ | ||
libboost-dev libboost-chrono-dev \ | ||
libboost-date-time-dev libboost-filesystem-dev \ | ||
libboost-program-options-dev \ | ||
libboost-test-dev libboost-timer-dev \ | ||
libzmq3-dev python3-dev \ | ||
build-essential swig cmake git | ||
|
||
WORKDIR /root/develop | ||
|
||
RUN git clone https://github.com/GMLC-TDC/HELICS-src.git helics | ||
|
||
WORKDIR /root/develop/helics/build | ||
|
||
RUN cmake \ | ||
-DBUILD_PYTHON_INTERFACE=ON \ | ||
-DBUILD_CXX_SHARED_LIB=ON \ | ||
-DPYTHON_INCLUDE_DIR=/usr/include/python3.6/ \ | ||
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so \ | ||
-DCMAKE_INSTALL_PREFIX=/helics \ | ||
.. | ||
RUN make -j8 install | ||
|
||
FROM ubuntu:18.04 | ||
|
||
RUN apt update && apt install -y --no-install-recommends \ | ||
libboost-chrono1.65.1 libboost-date-time1.65.1 \ | ||
libboost-filesystem1.65.1 libboost-program-options1.65.1 \ | ||
libboost-test1.65.1 libboost-timer1.65.1 libzmq5 | ||
|
||
COPY --from=builder /helics /usr/local/ | ||
|
||
ENV PYTHONPATH /usr/local/python | ||
|
||
# Python must be installed after the PYTHONPATH is set above for it to | ||
# recognize and import libhelicsSharedLib.so. | ||
RUN apt install -y --no-install-recommends python3-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
CMD ["python3", "-c", "import helics; print(helics.helicsGetVersion())"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
NAME := helics | ||
|
||
build: | ||
docker build --no-cache -t $(NAME) . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM helics as builder | ||
|
||
RUN apt update && apt install -y \ | ||
python3-pip git | ||
|
||
RUN pip3 install scipy | ||
|
||
WORKDIR /root/develop | ||
|
||
RUN git clone https://github.com/kdheepak/psst.git | ||
|
||
WORKDIR /root/develop/psst | ||
|
||
RUN pip3 install . \ | ||
&& cp -a psst/* /usr/local/lib/python3.6/dist-packages/psst | ||
|
||
FROM ubuntu:18.04 | ||
|
||
RUN apt update && apt install -y --no-install-recommends \ | ||
python3-pkg-resources python3-six python3-setuptools python3-idna \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /usr/local /usr/local/ | ||
|
||
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 | ||
|
||
CMD ["psst", "--version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
NAME := psst | ||
|
||
build: | ||
docker build -t $(NAME) . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM helics as builder | ||
|
||
RUN apt update && apt install -y \ | ||
python3-pip git | ||
|
||
RUN pip3 install git+git://github.com/GMLC-TDC/helics-runner.git@master | ||
|
||
FROM ubuntu:18.04 | ||
|
||
RUN apt update && apt install -y --no-install-recommends \ | ||
python3-pkg-resources python3-six \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /usr/local /usr/local/ | ||
|
||
ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 | ||
|
||
# The config file defaults to calling `python`. | ||
RUN ln -s /usr/bin/python3 /usr/bin/python | ||
|
||
CMD ["helics", "--version"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
NAME := helics-runner | ||
|
||
build: | ||
docker build -t $(NAME) . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
tutorials/1-DistributionFederation-ManualStart/docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
version: '3' | ||
services: | ||
broker: | ||
build: ../../Dockerfiles/helics | ||
command: | ||
- helics_broker | ||
- '2' | ||
- --loglevel=3 | ||
- --name=mainbroker | ||
image: helics | ||
federate: | ||
build: ../../Dockerfiles/helics | ||
command: | ||
- python3 | ||
- federate1.py | ||
image: helics | ||
volumes: | ||
- ../../:/helics-tutorial | ||
working_dir: /helics-tutorial/tutorials/1-DistributionFederation-ManualStart | ||
gridlab-d: | ||
build: ../../Dockerfiles/gridlab-d | ||
command: | ||
- gridlabd | ||
- DistributionSim_B2_G_1.glm | ||
environment: | ||
- LD_LIBRARY_PATH=/usr/local/lib | ||
image: gridlab-d | ||
volumes: | ||
- ../../:/helics-tutorial | ||
working_dir: /helics-tutorial/test_system_data/gldFeeders/B2/G_1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use a specific commit for the HELICS-Tutorial. Same for GridLAB-D, HELICS, GridDyn, psst etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kdheepak I'm assuming you mean update each Dockerfile that's cloning a git repo to use a specific branch, tag, or commit? I think I'm doing that in most, at least a specific branch... perhaps you're suggesting an actual commit hash just in case the branch goes away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I meant to say specific commit hash. In case the branch goes away when merged to another / is updated etc, this will still work. It gives more of a guarantee of reproducibility than just using the branch name.