diff --git a/.gitmodules b/.gitmodules index eb1354f..8ec2cd0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,9 @@ [submodule "src/timeloop-python"] path = src/timeloop-python url = https://github.com/Accelergy-Project/timeloop-python.git +[submodule "src/accelergy-mcpat-plug-in"] + path = src/accelergy-mcpat-plug-in + url = https://github.com/Accelergy-Project/accelergy-mcpat-plug-in.git +[submodule "src/mcpat"] + path = src/mcpat + url = https://github.com/HewlettPackard/mcpat.git diff --git a/Dockerfile b/Dockerfile index b39dd46..00cd6eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,20 @@ RUN apt-get update \ && make \ && chmod -R 777 . +# McPAT + +WORKDIR $BUILD_DIR + +COPY src/mcpat $BUILD_DIR/mcpat + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + g++-multilib \ + && rm -rf /var/lib/apt/lists/* \ + && cd mcpat \ + && make \ + && chmod -R 777 . + # Build and install timeloop WORKDIR $BUILD_DIR @@ -45,12 +59,14 @@ RUN apt-get update \ libncurses5-dev \ libtinfo-dev \ libgpm-dev \ + libgmp-dev \ && rm -rf /var/lib/apt/lists/* \ && cd ./timeloop/src \ && ln -s ../pat-public/src/pat . \ && cd .. \ - && scons --accelergy \ - && scons --static --accelergy \ + # --d for debug purpose + && scons --d --accelergy \ + && scons --d --static --accelergy \ && cp build/timeloop-mapper /usr/local/bin \ && cp build/timeloop-metrics /usr/local/bin \ && cp build/timeloop-model /usr/local/bin @@ -70,14 +86,16 @@ ARG BUILD_VERSION # Labels LABEL org.label-schema.schema-version="1.0" LABEL org.label-schema.build-date=$BUILD_DATE -LABEL org.label-schema.name="Accelergy-Project/accelergy-timeloop-infrastructure" +#LABEL org.label-schema.name="Accelergy-Project/accelergy-timeloop-infrastructure" +LABEL org.label-schema.name="Accelergy-Project/accelergy-timeloop-infrastructure-with-mcpat" LABEL org.label-schema.description="Infrastructure setup for Timeloop/Accelergy tools" LABEL org.label-schema.url="http://accelergy.mit.edu/" LABEL org.label-schema.vcs-url="https://github.com/Accelergy-Project/accelergy-timeloop-infrastructure" LABEL org.label-schema.vcs-ref=$VCS_REF LABEL org.label-schema.vendor="Wu" LABEL org.label-schema.version=$BUILD_VERSION -LABEL org.label-schema.docker.cmd="docker run -it --rm -v ~/workspace:/home/workspace timeloopaccelergy/accelergy-timeloop-infrastructure" +#LABEL org.label-schema.docker.cmd="docker run -it --rm -v ~/workspace:/home/workspace timeloopaccelergy/accelergy-timeloop-infrastructure" +LABEL org.label-schema.docker.cmd="docker run -it --rm -v ~/workspace:/home/workspace vi270662/accelergy-timeloop-infrastructure-with-mcpat" ENV BIN_DIR=/usr/local/bin ENV BUILD_DIR=/usr/local/src @@ -111,6 +129,10 @@ RUN apt-get update \ && useradd -m -d /home/workspace -c "Workspace User Account" -s /usr/sbin/nologin -g workspace workspace \ && if [ ! -d $BUILD_DIR ]; then mkdir $BUILD_DIR; fi +# For debug purpose +RUN apt-get update \ + && apt-get install -y --no-install-recommends gdb + # Get tools built in other containers WORKDIR $BUILD_DIR @@ -119,6 +141,7 @@ COPY --from=builder $BUILD_DIR/timeloop/build/timeloop-mapper $BIN_DIR COPY --from=builder $BUILD_DIR/timeloop/build/timeloop-metrics $BIN_DIR COPY --from=builder $BUILD_DIR/timeloop/build/timeloop-model $BIN_DIR COPY --from=builder $BUILD_DIR/cacti/cacti $BIN_DIR +COPY --from=builder $BUILD_DIR/mcpat/mcpat $BIN_DIR # Get libraries and includes @@ -151,6 +174,7 @@ WORKDIR $BUILD_DIR # Note source for accelergy was copied in above COPY --from=builder $BUILD_DIR/cacti $SHARE_DIR/accelergy/estimation_plug_ins/accelergy-cacti-plug-in/cacti +COPY --from=builder $BUILD_DIR/mcpat $SHARE_DIR/accelergy/estimation_plug_ins/accelergy-mcpat-plug-in/mcpat RUN python3 -m pip install setuptools \ && python3 -m pip install wheel \ @@ -166,9 +190,34 @@ RUN python3 -m pip install setuptools \ && python3 -m pip install . \ && chmod 777 $SHARE_DIR/accelergy/estimation_plug_ins/accelergy-cacti-plug-in/cacti \ && cd .. \ + && cd accelergy-mcpat-plug-in \ + && python3 -m pip install . \ + && chmod 777 $SHARE_DIR/accelergy/estimation_plug_ins/accelergy-mcpat-plug-in \ + && chmod 777 $SHARE_DIR/accelergy/estimation_plug_ins/accelergy-mcpat-plug-in/mcpat \ + && cd .. \ && cd accelergy-table-based-plug-ins \ && python3 -m pip install . +# Add conda and python3.8 (in conda) +# WARNING: Conda should be installed after Accelergy. Otherwise, some Accelergy +# data files are not installed correctly. +WORKDIR $BIN_DIR + +# Errors with the latest version of Miniconda (the bash execution solution +# does not work either) +# An older version is used (see https://repo.continuum.io/miniconda/) +# ( SHELL ["/bin/bash", "-c"] ) +#RUN wget -O ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ +RUN wget -O ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh \ + && chmod +x ~/miniconda.sh \ + && ~/miniconda.sh -b -p $BIN_DIR/conda \ + && rm ~/miniconda.sh +# ( SHELL ["/bin/sh", "-c"] ) + +ENV PATH=$BIN_DIR/conda/bin:$PATH + +RUN conda install -y python=3.8 + # PyTimeloop WORKDIR $BUILD_DIR diff --git a/Makefile b/Makefile index c8615a8..e2f365b 100644 --- a/Makefile +++ b/Makefile @@ -19,8 +19,10 @@ DOCKER_NAME ?= timeloopaccelergy VERSION := 0.2 -USER := timeloopaccelergy -REPO := accelergy-timeloop-infrastructure +#USER := timeloopaccelergy +USER := vi270662 +#REPO := accelergy-timeloop-infrastructure +REPO := accelergy-timeloop-infrastructure-with-mcpat NAME := ${USER}/${REPO} TAG := $$(git log -1 --pretty=%h) diff --git a/README_McPAT.md b/README_McPAT.md new file mode 100644 index 0000000..3321e5e --- /dev/null +++ b/README_McPAT.md @@ -0,0 +1,19 @@ +# McPAT plug-in + +For the McPAT plug-in to work with Timeloop, you need to modify two lines in the _src/mcpat/_ submodule: + +* Find the file _mcpat.mk_ + +* Modify the lines 25 and 26 from: + +``` +CXX = g++ -m32 +CC = gcc -m32 +``` + +to: + +``` +CXX = g++ -m64 +CC = gcc -m64 +``` diff --git a/docker-compose.yaml b/docker-compose.yaml index 7780902..864d456 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -21,7 +21,7 @@ version: '3' services: infrastructure: hostname: accelergy-timeloop - image: timeloopaccelergy/accelergy-timeloop-infrastructure:latest + image: vi270662/accelergy-timeloop-infrastructure-with-mcpat:latest volumes: - ./workspace:/home/workspace environment: diff --git a/src/accelergy-mcpat-plug-in b/src/accelergy-mcpat-plug-in new file mode 160000 index 0000000..fb0ed91 --- /dev/null +++ b/src/accelergy-mcpat-plug-in @@ -0,0 +1 @@ +Subproject commit fb0ed91449cea91c88647864d07d871c4de08a0e diff --git a/src/mcpat b/src/mcpat new file mode 160000 index 0000000..f444ca3 --- /dev/null +++ b/src/mcpat @@ -0,0 +1 @@ +Subproject commit f444ca3997a25deafa431e87752e182b5e66c2a8