diff --git a/CHANGELOG.md b/CHANGELOG.md index c796611..6c66273 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## Release v4.0.0 + +[Link to release][v400] + +Introduced support to new OS and WOSS versions: + +- OS: Ubuntu 22.04 LTS + +- WOSS: 1.12.6 + +Moreover, starting from this release images are based on [`egiona/ns3-base`][ns3-base], effectively decoupling the support for new ns-3 versions from WOSS. +This choice aims at providing more granularity for end users, as well as allowing the upgrade of ns-3 version independently from WOSS. + +For instance, at the time of the present release, WOSS 1.12.6 cannot be integrated with ns-3 due to the latest changes to the `core` module shipped in ns-3.41. + ## Release v3.0.1 [Link to release][v301] @@ -92,6 +107,7 @@ Supported versions: [v110]: https://github.com/SENSES-Lab-Sapienza/ns3-woss-docker/releases/tag/v1.1.0 [v201]: https://github.com/SENSES-Lab-Sapienza/ns3-woss-docker/releases/tag/v2.0.1 [v301]: https://github.com/SENSES-Lab-Sapienza/ns3-woss-docker/releases/tag/v3.0.1 +[v400]: https://github.com/emanuelegiona/ns3-woss-docker/releases/tag/v4.0.0 [ns3-cmake]: https://www.nsnam.org/docs/manual/html/working-with-cmake.html @@ -99,3 +115,6 @@ Supported versions: [gcc-8-issue]: https://gitlab.com/nsnam/ns-3-dev/-/blob/ns-3.36/RELEASE_NOTES.md#release-336 [woss-netcdf-crash]: https://github.com/MetalKnight/woss-ns3/issues/43#event-10588536371 + + +[ns3-base]: https://github.com/emanuelegiona/ns3-base-docker/ diff --git a/CITATION.cff b/CITATION.cff index e7a3b27..c3efcd8 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -17,11 +17,11 @@ authors: University of Rome orcid: 'https://orcid.org/0000-0003-0871-7156' url: >- - https://github.com/SENSES-Lab-Sapienza/ns3-woss-docker + https://github.com/emanuelegiona/ns3-woss-docker keywords: - docker - ns-3 - woss - network-simulation license: MIT -doi: 10.5281/zenodo.5727519 +doi: 10.5281/zenodo.5727518 diff --git a/README.md b/README.md index 898041a..b5d8c71 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,11 @@ [ns-3][ns3] and [WOSS][woss] bundles using [Docker][docker]. -The scope of this repository is to automate the installation process of both -ns-3 and WOSS library, in order to provide a hassle-free setup process for a -simulation environment. - -Images ship with fully-functioning ns-3 and WOSS library installations, also -including the corresponding [woss-ns3 module][woss-ns3]. -ns-3 is provided pre-built in `debug` and `optimized` profiles, with the -*former* being the active version on a first run; utility scripts to quickly -switch between them are provided (see below). +The scope of this repository is to automate the installation process of both ns-3 and WOSS library, in order to provide a hassle-free setup process for a simulation environment. + +Images are based on [`egiona/ns3-base`][ns3-base-docker], shipping with WOSS library and the corresponding [woss-ns3 module][woss-ns3] installed. +Please refer to the [`ns3-base`][ns3-base] repository for further details regarding available ns-3 configurations and utilities. + Database configuration is left to the user, mainly for Docker image size purposes. @@ -18,17 +14,17 @@ purposes. Docker image name: [**`egiona/ns3-woss`**][docker-hub-repo]. -| Docker image tag | OS | ns-3 | Build system | WOSS | Dockerfile | -| :---: | :---: | :---: | :---: | :---: | :---: | -| [`u20.04-n3.40-w1.12.5`][image5] | Ubuntu 20.04 | [3.40][ns3.40] | CMake | [1.12.5][woss-changelog] | [link][file5] | -| [`u18.04-n3.35-w1.12.5`][image3] | Ubuntu 18.04 | [3.35][ns3.35] | Waf | [1.12.5][woss-changelog] | [link][file3] | -| [`u18.04-n3.34-w1.12.5`][image2] | Ubuntu 18.04 | [3.34][ns3.34] | Waf | [1.12.5][woss-changelog] | [link][file2] | -| [`u18.04-n3.33-w1.12.5`][image1] | Ubuntu 18.04 | [3.33][ns3.33] | Waf | [1.12.5][woss-changelog] | [link][file1] | +| Docker image tag | `egiona/ns3-base` | WOSS | Dockerfile | +| :---: | :---: | :---: | :---: | +| [`u22.04-n3.40-w1.12.6`][img5] | [`u22.04-n3.40`][ns3-base-changelog] | [1.12.6][woss-changelog] | [link][file5] | +| [`u20.04-n3.40-w1.12.6`][img4] | [`u20.04-n3.40`][ns3-base-changelog] | [1.12.6][woss-changelog] | [link][file5] | +| [`u18.04-n3.35-w1.12.6`][img3] | [`u18.04-n3.35`][ns3-base-changelog] | [1.12.6][woss-changelog] | [link][file3] | +| [`u18.04-n3.34-w1.12.6`][img2] | [`u18.04-n3.34`][ns3-base-changelog] | [1.12.6][woss-changelog] | [link][file2] | +| [`u18.04-n3.33-w1.12.6`][img1] | [`u18.04-n3.33`][ns3-base-changelog] | [1.12.6][woss-changelog] | [link][file1] | Full changelog can be found at [this page](./CHANGELOG.md). -> New revisions of images (_i.e. `-rN` suffix_) **do not overwrite** previous ones in order to provide backwards compatibility. -Previous tags can still be found on [DockerHub][docker-hub-repo], but their use is discouraged. +_Previous tags are still available on [DockerHub][docker-hub-repo], unless they have been discontinued (see below)._ ### Discontinued images @@ -36,7 +32,7 @@ The following image tags have been discontinued and are not available from the D If you are using any of these tags, please consider switching to a different one that is still supported. -| Docker image tag | Reason | Date | +| Docker image tag | Motivation | Date | | :---: | :---: | :---: | | `u20.04-n3.37-w1.12.5`
`u18.04-n3.37-w1.12.4-r2`
`u18.04-n3.37-w1.12.4` | GCC compiler issues;
not solved by Ubuntu 20.04 upgrade | 2023/10/11 | @@ -46,7 +42,7 @@ Any problems should be reported via the GitHub issue tracker. Users are welcomed to contribute new images (_e.g._ different base image or other ns-3 versions) via Pull Request and adhering to the following style: -- Directory named `` with: `A` equal to an arbitrary versioned base image short-hand (_i.e._ `u20.04` refers to Ubuntu 20.04); `B` equal to the ns-3 version bundled (_i.e._ `n3.40` refers to ns-3.40); and `C` equal to the WOSS version bundled (_i.e._ `w1.12.5` refers to WOSS 1.12.5). +- Directory named `` with: `A` equal to an arbitrary versioned base image short-hand (_i.e._ `u22.04-n3.40` refers to the same `egiona/ns3-base` tag); and `B` equal to the WOSS version bundled (_i.e._ `w1.12.6` refers to WOSS 1.12.6). Such directory name will also be used as image tag. @@ -103,6 +99,7 @@ However, _utility scripts_ are only provided for UNIX-like systems. This script allows for easy decoupling of development directory from ns-3's source directory. Indeed, it is possible to keep novel modules and program driver scripts outside `src` (or `contrib`) and `scratch` directories of the ns-3 installation directory during development, and only copying them afterwards. + This is especially useful when paired with mounted directories. Multiple targets are present, allowing: ns-3 current version checking, compilation and execution of simulation driver programs (copying them to `scratch` subdir first), management of ns-3 modules (creation in `contrib` subdir and copy outside, synchronization of contents, elimination), and debugging (GNU debugger, Valgrind, ns-3 tests). @@ -133,17 +130,19 @@ However, it is advisable to keep a _local backup copy_ of your modules and exper 4. Mount a local directory into a container (just once, instead of `docker run`) using - `./mount.sh ` + `docker run -td --mount type=bind,source=,target= --name ` - _Local path to be mounted must be absolute. The path within a container's filesystem is placed under its_  `/home/` _directory._ + _Paths to be mounted must be absolute._ _This is only needed the **first time** a container is instantiated, subsequent calls to_  `docker start` _on the same container will automatically load the mounted directory._ + _**Warning:** existing container contents at the same target path will be overwritten with the ones provided by the local filesystem._ + 5. Starting from `r2` images onwards, an environment variable `CXX_CONFIG` is available for user-defined scripts to adapt their GCC compilation parameters; by default, such variable holds the following contents: `CXX_CONFIG="-Wall -Werror -Wno-unused-variable"` - Moreover, [build scripts](./u20.04-n3.40-w1.12.5/ns3-build/) have been updated to provide an exit value reflective of ns-3's configuration and build outcome. + Moreover, [build scripts][latest-build] have been updated to provide an exit value reflective of ns-3's configuration and build outcome. # Citing this work @@ -151,17 +150,17 @@ If you use any of the Docker images described in this repository, please cite th **APA** ``` -Giona, E. ns-3 and WOSS Docker images [Computer software]. https://doi.org/10.5281/zenodo.5727519 +Giona, E. ns-3 and WOSS Docker images [Computer software]. https://doi.org/10.5281/zenodo.5727518 ``` **BibTeX** ``` @software{Giona_ns-3_and_WOSS, author = {Giona, Emanuele}, -doi = {10.5281/zenodo.5727519}, +doi = {10.5281/zenodo.5727518}, license = {MIT}, title = {{ns-3 and WOSS Docker images}}, -url = {https://github.com/SENSES-Lab-Sapienza/ns3-woss-docker} +url = {https://github.com/emanuelegiona/ns3-woss-docker} } ``` @@ -169,7 +168,7 @@ Bibliography entries generated using [Citation File Format][cff] described in th # License -**Copyright (c) 2023 Emanuele Giona ([SENSES Lab][senseslab], Sapienza University of Rome)** +**Copyright (c) 2024 Emanuele Giona ([SENSES Lab][senseslab], Sapienza University of Rome)** This repository and Docker images themselves are distributed under [MIT license][docker-license]. @@ -188,27 +187,28 @@ chosen for the Docker images does not necessarily apply to them. [woss-ns3]: https://github.com/MetalKnight/woss-ns3 [docker-hub-repo]: https://hub.docker.com/r/egiona/ns3-woss +[ns3-base-docker]: https://hub.docker.com/r/egiona/ns3-base -[ns3.33]: https://www.nsnam.org/releases/ns-3-33/ -[ns3.34]: https://www.nsnam.org/releases/ns-3-34/ -[ns3.35]: https://www.nsnam.org/releases/ns-3-35/ -[ns3.40]: https://www.nsnam.org/releases/ns-3-40/ +[ns3-base]: https://github.com/emanuelegiona/ns3-base-docker +[ns3-base-changelog]: https://github.com/emanuelegiona/ns3-base-docker/blob/main/CHANGELOG.md [woss-changelog]: https://woss.dei.unipd.it/woss/doxygen/Changelog.html -[latest-debug]: ./u20.04-n3.40-w1.12.5/ns3-build/build-debug.sh -[latest-optimized]: ./u20.04-n3.40-w1.12.5/ns3-build/build-optimized.sh -[latest-build]: ./u20.04-n3.40-w1.12.5/ns3-build/ -[latest-makefile]: ./u20.04-n3.40-w1.12.5/ns3-utils/Makefile - -[image5]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u20.04-n3.40-w1.12.5 -[image3]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.35-w1.12.5 -[image2]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.34-w1.12.5 -[image1]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.33-w1.12.5 -[file5]: ./u20.04-n3.40-w1.12.5/Dockerfile -[file3]: ./u18.04-n3.35-w1.12.5/Dockerfile -[file2]: ./u18.04-n3.34-w1.12.5/Dockerfile -[file1]: ./u18.04-n3.33-w1.12.5/Dockerfile +[latest-debug]: ./u22.04-n3.40-w1.12.6/ns3-build/build-debug.sh +[latest-optimized]: ./u22.04-n3.40-w1.12.6/ns3-build/build-optimized.sh +[latest-build]: ./u22.04-n3.40-w1.12.6/ns3-build/ +[latest-makefile]: ./u22.04-n3.40-w1.12.6/ns3-utils/Makefile + +[img5]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u22.04-n3.40-w1.12.6 +[img4]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u20.04-n3.40-w1.12.6 +[img3]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.35-w1.12.6 +[img2]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.34-w1.12.6 +[img1]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.33-w1.12.6 +[file5]: ./u22.04-n3.40-w1.12.6/Dockerfile +[file4]: ./u20.04-n3.40-w1.12.6/Dockerfile +[file3]: ./u18.04-n3.35-w1.12.6/Dockerfile +[file2]: ./u18.04-n3.34-w1.12.6/Dockerfile +[file1]: ./u18.04-n3.33-w1.12.6/Dockerfile [docker-install]: https://docs.docker.com/engine/install/ diff --git a/mount.sh b/build-all.sh similarity index 70% rename from mount.sh rename to build-all.sh index 474fb85..adbe8cf 100755 --- a/mount.sh +++ b/build-all.sh @@ -2,7 +2,7 @@ # MIT License -# Copyright (c) 2021 Emanuele Giona (SENSES Lab, +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, # Sapienza University of Rome) # Permission is hereby granted, free of charge, to any person obtaining a copy @@ -23,6 +23,16 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -docker run -t -d --mount type=bind,source=$1,target=/home/$2 --name $3 $4 +IMG_NAME=egiona/ns3-woss -exit 0 +# Iterate on all supported configurations and (re)build images +for img_dir in */ ; do + CURR_TAG="${img_dir%/}" + + echo ">>> Building image '${IMG_NAME}:${CURR_TAG}'..." + cd "${CURR_TAG}" && \ + docker buildx build -t "${IMG_NAME}:${CURR_TAG}" . && \ + docker push "${IMG_NAME}:${CURR_TAG}" && \ + docker image rm "${IMG_NAME}:${CURR_TAG}" && \ + cd .. +done diff --git a/u18.04-n3.33-w1.12.6/Dockerfile b/u18.04-n3.33-w1.12.6/Dockerfile new file mode 100644 index 0000000..5158e24 --- /dev/null +++ b/u18.04-n3.33-w1.12.6/Dockerfile @@ -0,0 +1,109 @@ +# syntax=docker/dockerfile:1 + +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +FROM egiona/ns3-base:u18.04-n3.33 + +LABEL maintainer="giona.emanuele@gmail.com" +LABEL version="0.1" +LABEL description="ns3-base:u18.04-n3.33 and WOSS 1.12.6" + +ARG WOSS_VER="1.12.6" +ARG TMP_DOWNLOAD_DIR="/home/downloads" +ARG WOSS_LIB_BASE="/home/woss" + +# ===== Evinronment variables available in containers too ===== +# ns3-base provides the following environment variables already: +# - NS3_DEBUG_DIR: installation directory for ns-3 in 'debug' profile +# - NS3_OPTIMIZED_DIR: installation directory for ns-3 in 'optimized' profile +# - NS3_PY_ENV: ns-3 dedicated Python 3 environment + +# WOSS-related variables +ENV WOSS_LIB_SRC="$WOSS_LIB_BASE/WOSS-$WOSS_VER" +ENV WOSS_LIB_DIR="/home/woss_lib" +ENV WOSS_REQS_DIR="/home/woss_reqs" + +# ===== Basic OS updates and ns-3 requirements ===== +ARG DEBIAN_FRONTEND=noninteractive +RUN apt -y update && apt -y upgrade && \ +# ===== Downloading: WOSS requirements and library ===== + cd /home && mkdir "$TMP_DOWNLOAD_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + # WOSS requirements + mkdir "$WOSS_LIB_BASE" && mkdir "$WOSS_REQS_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + wget http://oalib.hlsresearch.com/AcousticsToolbox/at_2023_5_18.zip && \ + unzip at_2023_5_18.zip && rm at/Makefile && mv at "$WOSS_REQS_DIR/" && \ + wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_14_2.tar.gz && \ + tar -xf hdf5-1_14_2.tar.gz && \ + wget https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netcdf-c-4.9.2.tar.gz && \ + tar -xf netcdf-c-4.9.2.tar.gz && \ + wget https://downloads.unidata.ucar.edu/netcdf-cxx/4.3.1/netcdf-cxx4-4.3.1.tar.gz && \ + tar -xf netcdf-cxx4-4.3.1.tar.gz && \ + # WOSS library source and ns-3 module + wget "https://github.com/signetlabdei/WOSS/archive/refs/tags/$WOSS_VER.tar.gz" && \ + tar -xf "$WOSS_VER.tar.gz" && mv "WOSS-$WOSS_VER" "$WOSS_LIB_BASE" && \ + wget "https://github.com/MetalKnight/woss-ns3/archive/refs/tags/v$WOSS_VER.tar.gz" && \ + tar -xf "v$WOSS_VER.tar.gz" && mv "woss-ns3-$WOSS_VER" "$WOSS_LIB_BASE" + +# ===== Installing: WOSS requirements and WOSS library ===== +COPY at/Makefile "$WOSS_REQS_DIR/at/" +RUN cd "$WOSS_REQS_DIR/at" && \ + make clean && make && \ + echo "export PATH=$PATH:$WOSS_REQS_DIR/at/Bellhop/" >> ~/.bashrc && \ + # HDF5 + cd "$TMP_DOWNLOAD_DIR" && cd hdf5-hdf5-1_14_2 && \ + ./configure --enable-shared --prefix="$WOSS_REQS_DIR" && \ + make && make install && \ + # NetCDF-C + cd ../netcdf-c-4.9.2 && \ + ./configure --prefix="$WOSS_REQS_DIR" --enable-netcdf-4 --enable-shared --disable-dap --disable-byterange CPPFLAGS="$CPPFLAGS -I$WOSS_REQS_DIR/include" LDFLAGS="$LDFLAGS -L$WOSS_REQS_DIR/lib" && \ + make && make install && \ + # NetCDF-C++ + cd ../netcdf-cxx4-4.3.1 && \ + ./configure --prefix="$WOSS_REQS_DIR" --enable-shared CPPFLAGS="$CPPFLAGS -I$WOSS_REQS_DIR/include" LDFLAGS="$LDFLAGS -L$WOSS_REQS_DIR/lib" && \ + make && make install && \ + # WOSS library + mkdir "$WOSS_LIB_DIR" && cd "$WOSS_LIB_SRC" && \ + ./autogen.sh && ./configure --with-netcdf4="$WOSS_REQS_DIR" --with-pthread --prefix="$WOSS_LIB_DIR" && \ + make && make install + +# ===== Building: ns-3 with WOSS; Cleanup: temporary downloads directory ===== +ENV WOSS_LIB_DIR="/home/woss_lib/lib" +ENV CXX_CONFIG="-Wall -Werror -Wno-unused-variable" + +COPY ns3-build/* ns3-utils/* /home/ +RUN cd /home && \ + # Build: debug + cp -R "$WOSS_LIB_BASE/woss-ns3-$WOSS_VER/" "$NS3_DEBUG_DIR/src/" && \ + mv "$NS3_DEBUG_DIR/src/woss-ns3-$WOSS_VER" "$NS3_DEBUG_DIR/src/woss-ns3" && \ + chmod +x build-debug.sh && ./build-debug.sh && \ + # Build: optimized + cp -R "$WOSS_LIB_BASE/woss-ns3-$WOSS_VER/" "$NS3_OPTIMIZED_DIR/src/" && \ + mv "$NS3_OPTIMIZED_DIR/src/woss-ns3-$WOSS_VER" "$NS3_OPTIMIZED_DIR/src/woss-ns3" && \ + chmod +x build-optimized.sh && ./build-optimized.sh && \ + # Utility for switching between profiles + # [ ns3-base already provides the .bashrc signal trap ] + # Cleanup + rm -rf "$TMP_DOWNLOAD_DIR" && ./build-debug.sh + +CMD ["/bin/bash"] diff --git a/u18.04-n3.33-w1.12.6/at/Makefile b/u18.04-n3.33-w1.12.6/at/Makefile new file mode 100644 index 0000000..3dd8a90 --- /dev/null +++ b/u18.04-n3.33-w1.12.6/at/Makefile @@ -0,0 +1,89 @@ +# Copyright (C) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) +# +# Adapted from Michael B. Porter +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# +# To install the Acoustics Toolbox: +# +# 1) Uncomment the appropriate lines below to select your FORTRAN compiler +# (also be sure to comment out all of the lines corresponding to the other compilers). + +# 2) If you're using gfortran check the -march switch that selects the chip you're using. +# Usually -march=native works + +# 3) From a command line shell, run: +# % make clean +# % make + +# on some machines you need to say -mcmodel=medium (or large) to allow for variables larger than 2 gig + +# ______________________________________________________________________________ + +# *** GNU Compiler Collection GFORTRAN +export FC=gfortran +export FFLAGS= -march=native -Bstatic -Waliasing -Wampersand -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -std=gnu -O1 -ffast-math -funroll-all-loops -fomit-frame-pointer -mtune=native +export RM=rm +export CC=gcc +export CFLAGS=-g +export FFLAGS+= -I../misc -I../tslib +export LAPACK_LIBS = -llapack + +all: + (cd misc; make -k all) + (cd tslib; make -k all) + (cd Bellhop; make -k all) + (cd Kraken; make -k all) + (cd KrakenField; make -k all) + # (cd Krakel; make -k all) + (cd Scooter; make -k all) + @echo " " + @echo "***********************************" + @echo "***** Acoustics Toolbox built *****" + @echo "***********************************" + +install: + (cd misc; make -k all) + (cd tslib; make -k all) + (cd Bellhop; make -k install) + (cd Kraken; make -k install) + (cd KrakenField; make -k install) + # (cd Krakel; make -k install) + (cd Scooter; make -k install) + @echo " " + @echo "***************************************" + @echo "***** Acoustics Toolbox installed *****" + @echo "***************************************" + +clean: + -rm -f bin/*.exe + find . -name '*.dSYM' -exec rm -r {} + + find . -name '*.png' -exec rm -r {} + + find . -name '*.eps' -exec rm -r {} + + find . -name '*.mod' -exec rm -r {} + + find . -name '*.grn' -exec rm -r {} + + find . -name '*.shd' -exec rm -r {} + + find . -name '*.shd.mat' -exec rm -r {} + + find . -name '*.prt' -exec rm -r {} + + (cd misc; make -k -i clean) + (cd tslib; make -k -i clean) + (cd Bellhop; make -k -i clean) + (cd Kraken; make -k -i clean) + (cd KrakenField; make -k -i clean) + (cd Krakel; make -k -i clean) + (cd Scooter; make -k -i clean) + (cd tests; make -k -i clean) + diff --git a/u18.04-n3.33-w1.12.6/ns3-build/build-debug.sh b/u18.04-n3.33-w1.12.6/ns3-build/build-debug.sh new file mode 100644 index 0000000..3d26844 --- /dev/null +++ b/u18.04-n3.33-w1.12.6/ns3-build/build-debug.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +NS3_DIR=${NS3_DEBUG_DIR} + +echo "Switching to debug profile in ns-3..." + +cd $NS3_DIR + +NS3_CONFIG="--build-profile=debug --out=build --enable-examples --enable-tests" +WOSS_CONFIG="--with-woss-source=${WOSS_LIB_SRC} --with-woss-library=${WOSS_LIB_DIR} --with-netcdf4-install=${WOSS_REQS_DIR}" + +. ${NS3_PY_ENV}/bin/activate + +OUTCOME=1 +CXXFLAGS="${CXX_CONFIG}" ./waf configure $WOSS_CONFIG $NS3_CONFIG && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: configuration failed" + exit 1 +fi + +OUTCOME=1 +./waf build && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: build failed" + exit 1 +fi + +./waf --check-profile +deactivate + +sed -i 's/^\(export NS3_CURR_PROFILE=\).*$/\1${NS3_DEBUG_DIR}/' ~/.bashrc && \ +cd /home && \ +kill -USR1 $PPID + +exit 0 diff --git a/u18.04-n3.33-w1.12.6/ns3-build/build-optimized.sh b/u18.04-n3.33-w1.12.6/ns3-build/build-optimized.sh new file mode 100644 index 0000000..20138a4 --- /dev/null +++ b/u18.04-n3.33-w1.12.6/ns3-build/build-optimized.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# MIT License + +# Copyright (c) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +NS3_DIR=${NS3_OPTIMIZED_DIR} + +echo "Switching to optimized profile in ns-3..." + +cd $NS3_DIR + +NS3_CONFIG="--build-profile=optimized --out=build --enable-examples --enable-tests" +WOSS_CONFIG="--with-woss-source=${WOSS_LIB_SRC} --with-woss-library=${WOSS_LIB_DIR} --with-netcdf4-install=${WOSS_REQS_DIR}" +CXX_CONFIG="-Wall" + +. ${NS3_PY_ENV}/bin/activate + +OUTCOME=1 +CXXFLAGS="${CXX_CONFIG}" ./waf configure $WOSS_CONFIG $NS3_CONFIG && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: configuration failed" + exit 1 +fi + +OUTCOME=1 +./waf build && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: build failed" + exit 1 +fi + +./waf --check-profile +deactivate + +sed -i 's/^\(export NS3_CURR_PROFILE=\).*$/\1${NS3_OPTIMIZED_DIR}/' ~/.bashrc && \ +cd /home && \ +kill -USR1 $PPID + +exit 0 diff --git a/u18.04-n3.33-w1.12.6/ns3-utils/Makefile b/u18.04-n3.33-w1.12.6/ns3-utils/Makefile new file mode 100644 index 0000000..1ecc311 --- /dev/null +++ b/u18.04-n3.33-w1.12.6/ns3-utils/Makefile @@ -0,0 +1,182 @@ +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +CWD := $(CURDIR) + +.ONESHELL: + +help: + @echo "Usage: make target [arguments]" + @echo "Targets:" + @echo " - help\n\tShows this help message." + @echo " --- Builds profiles ---" + @echo " - show_profile\n\tShows the ns-3 build profile currently in use." + @echo " --- Simulation driver programs ---" + @echo " - compile FILE=\n\tCopies the given driver program, then uses ./waf to compile it against ns-3." + @echo " - build_run FILE= [ARGS=] [LOG=]\n\tBuilds and executes the given driver program." + @echo " - run FILE= [ARGS=] [LOG=]\n\tExecutes the given driver program (no building first)." + @echo " - clean FILE=\n\tDeletes the given driver program." + @echo " --- Modules ---" + @echo " - new_module FILE=\n\tUses a ns-3 utility to create a new module under 'contrib/' with the given name, also copying it locally." + @echo " - sync_module FILE=\n\tReplaces contents of the module under 'contrib/' with local contents." + @echo " - rm_module FILE=\n\tRemoves the module with the given name (placed under 'contrib/')." + @echo " --- Debug ---" + @echo " - valgrind FILE= LOG=\n\tRuns the driver program through the Valgrind memory checking tool, writing the log to a file." + @echo " - gdb FILE=\n\tRuns the driver program through the GNU debugger." + @echo " - test SUITE= [LOG=]\n\tRuns the ns-3 testing tool selecting the given test suite." + @echo " - gdb_test SUITE=\n\tRuns the ns-3 testing tool selecting the given test suite, through the GNU debugger." + +show_profile: + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --check-profile + @deactivate + +compile: +ifeq ($(FILE),) + $(error 'compile' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Compiling..." + @cp -f $(FILE) $(NS3_CURR_PROFILE)/scratch/ + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf + @deactivate + @echo " Done." + +build_run: +ifeq ($(FILE),) + $(error 'build_run' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " $(shell date): running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./waf --run scratch/$(FILE) --command-template="%s $(ARGS)" +else + @./waf --run scratch/$(FILE) --command-template="%s $(ARGS)" >> $(LOG) 2>&1 +endif + @deactivate + @echo " $(shell date): done." + +run: +ifeq ($(FILE),) + $(error 'run' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " $(shell date): running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./waf --run-no-build scratch/$(FILE) --command-template="%s $(ARGS)" +else + @./waf --run-no-build scratch/$(FILE) --command-template="%s $(ARGS)" >> $(LOG) 2>&1 +endif + @deactivate + @echo " $(shell date): done." + +clean: +ifeq ($(FILE),) + $(error 'clean' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Cleaning..." + @cd $(NS3_CURR_PROFILE) + @rm scratch/$(FILE) + @echo " Done." + +new_module: +ifeq ($(FILE),) + $(error 'new_module' target requires a FILE variable with the new module's name) +endif + @echo " Creating new module $(NS3_CURR_PROFILE)/contrib/$(FILE)..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./utils/create-module.py contrib/$(FILE) + @cd $(CWD) + @cp -rf $(NS3_CURR_PROFILE)/contrib/$(FILE) $(FILE)/ + @deactivate + @echo " Done." + +rm_module: +ifeq ($(FILE),) + $(error 'rm_module' target requires a FILE variable with the module's name) +endif + @echo " Removing module contrib/$(FILE)..." + @rm -rf $(NS3_CURR_PROFILE)/contrib/$(FILE) + @echo " Done." + +sync_module: +ifeq ($(FILE),) + $(error 'sync_module' target requires a FILE variable with the module's name) +endif + @echo " Syncronizing module..." + @make rm_module FILE=$(FILE) + @cp -rf $(FILE)/ $(NS3_CURR_PROFILE)/contrib/ + @echo " Done." + +valgrind: +ifeq ($(FILE),) + $(error 'valgrind' target requires a FILE variable with the ns-3 driver program name) +endif +ifeq ($(LOG),) + $(error 'valgrind' target requires a LOG variable with the path to the log file) +endif + @echo " Running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --run scratch/$(FILE) --command-template="valgrind --leak-check=full --show-leak-kinds=all --log-file=$(LOG) %s" + @deactivate + @echo " Done." + +gdb: +ifeq ($(FILE),) + $(error 'gdb' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --run scratch/$(FILE) --command-template="gdb %s" + @deactivate + @echo " Done." + +test: +ifeq ($(SUITE),) + $(error 'test' target requires a SUITE variable with the ns-3 test suite name) +endif + @echo " Testing..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./test.py -n -s $(SUITE) +else + @./test.py -n -s $(SUITE) --text=$(LOG) +endif + @deactivate + @echo " Done." + +gdb_test: + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --run test-runner --command-template="gdb %s" + @deactivate + +.PHONY: clean diff --git a/u18.04-n3.34-w1.12.6/Dockerfile b/u18.04-n3.34-w1.12.6/Dockerfile new file mode 100644 index 0000000..2f7f34e --- /dev/null +++ b/u18.04-n3.34-w1.12.6/Dockerfile @@ -0,0 +1,109 @@ +# syntax=docker/dockerfile:1 + +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +FROM egiona/ns3-base:u18.04-n3.34 + +LABEL maintainer="giona.emanuele@gmail.com" +LABEL version="0.1" +LABEL description="ns3-base:u18.04-n3.34 and WOSS 1.12.6" + +ARG WOSS_VER="1.12.6" +ARG TMP_DOWNLOAD_DIR="/home/downloads" +ARG WOSS_LIB_BASE="/home/woss" + +# ===== Evinronment variables available in containers too ===== +# ns3-base provides the following environment variables already: +# - NS3_DEBUG_DIR: installation directory for ns-3 in 'debug' profile +# - NS3_OPTIMIZED_DIR: installation directory for ns-3 in 'optimized' profile +# - NS3_PY_ENV: ns-3 dedicated Python 3 environment + +# WOSS-related variables +ENV WOSS_LIB_SRC="$WOSS_LIB_BASE/WOSS-$WOSS_VER" +ENV WOSS_LIB_DIR="/home/woss_lib" +ENV WOSS_REQS_DIR="/home/woss_reqs" + +# ===== Basic OS updates and ns-3 requirements ===== +ARG DEBIAN_FRONTEND=noninteractive +RUN apt -y update && apt -y upgrade && \ +# ===== Downloading: WOSS requirements and library ===== + cd /home && mkdir "$TMP_DOWNLOAD_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + # WOSS requirements + mkdir "$WOSS_LIB_BASE" && mkdir "$WOSS_REQS_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + wget http://oalib.hlsresearch.com/AcousticsToolbox/at_2023_5_18.zip && \ + unzip at_2023_5_18.zip && rm at/Makefile && mv at "$WOSS_REQS_DIR/" && \ + wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_14_2.tar.gz && \ + tar -xf hdf5-1_14_2.tar.gz && \ + wget https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netcdf-c-4.9.2.tar.gz && \ + tar -xf netcdf-c-4.9.2.tar.gz && \ + wget https://downloads.unidata.ucar.edu/netcdf-cxx/4.3.1/netcdf-cxx4-4.3.1.tar.gz && \ + tar -xf netcdf-cxx4-4.3.1.tar.gz && \ + # WOSS library source and ns-3 module + wget "https://github.com/signetlabdei/WOSS/archive/refs/tags/$WOSS_VER.tar.gz" && \ + tar -xf "$WOSS_VER.tar.gz" && mv "WOSS-$WOSS_VER" "$WOSS_LIB_BASE" && \ + wget "https://github.com/MetalKnight/woss-ns3/archive/refs/tags/v$WOSS_VER.tar.gz" && \ + tar -xf "v$WOSS_VER.tar.gz" && mv "woss-ns3-$WOSS_VER" "$WOSS_LIB_BASE" + +# ===== Installing: WOSS requirements and WOSS library ===== +COPY at/Makefile "$WOSS_REQS_DIR/at/" +RUN cd "$WOSS_REQS_DIR/at" && \ + make clean && make && \ + echo "export PATH=$PATH:$WOSS_REQS_DIR/at/Bellhop/" >> ~/.bashrc && \ + # HDF5 + cd "$TMP_DOWNLOAD_DIR" && cd hdf5-hdf5-1_14_2 && \ + ./configure --enable-shared --prefix="$WOSS_REQS_DIR" && \ + make && make install && \ + # NetCDF-C + cd ../netcdf-c-4.9.2 && \ + ./configure --prefix="$WOSS_REQS_DIR" --enable-netcdf-4 --enable-shared --disable-dap --disable-byterange CPPFLAGS="$CPPFLAGS -I$WOSS_REQS_DIR/include" LDFLAGS="$LDFLAGS -L$WOSS_REQS_DIR/lib" && \ + make && make install && \ + # NetCDF-C++ + cd ../netcdf-cxx4-4.3.1 && \ + ./configure --prefix="$WOSS_REQS_DIR" --enable-shared CPPFLAGS="$CPPFLAGS -I$WOSS_REQS_DIR/include" LDFLAGS="$LDFLAGS -L$WOSS_REQS_DIR/lib" && \ + make && make install && \ + # WOSS library + mkdir "$WOSS_LIB_DIR" && cd "$WOSS_LIB_SRC" && \ + ./autogen.sh && ./configure --with-netcdf4="$WOSS_REQS_DIR" --with-pthread --prefix="$WOSS_LIB_DIR" && \ + make && make install + +# ===== Building: ns-3 with WOSS; Cleanup: temporary downloads directory ===== +ENV WOSS_LIB_DIR="/home/woss_lib/lib" +ENV CXX_CONFIG="-Wall -Werror -Wno-unused-variable" + +COPY ns3-build/* ns3-utils/* /home/ +RUN cd /home && \ + # Build: debug + cp -R "$WOSS_LIB_BASE/woss-ns3-$WOSS_VER/" "$NS3_DEBUG_DIR/src/" && \ + mv "$NS3_DEBUG_DIR/src/woss-ns3-$WOSS_VER" "$NS3_DEBUG_DIR/src/woss-ns3" && \ + chmod +x build-debug.sh && ./build-debug.sh && \ + # Build: optimized + cp -R "$WOSS_LIB_BASE/woss-ns3-$WOSS_VER/" "$NS3_OPTIMIZED_DIR/src/" && \ + mv "$NS3_OPTIMIZED_DIR/src/woss-ns3-$WOSS_VER" "$NS3_OPTIMIZED_DIR/src/woss-ns3" && \ + chmod +x build-optimized.sh && ./build-optimized.sh && \ + # Utility for switching between profiles + # [ ns3-base already provides the .bashrc signal trap ] + # Cleanup + rm -rf "$TMP_DOWNLOAD_DIR" && ./build-debug.sh + +CMD ["/bin/bash"] diff --git a/u18.04-n3.34-w1.12.6/at/Makefile b/u18.04-n3.34-w1.12.6/at/Makefile new file mode 100644 index 0000000..3dd8a90 --- /dev/null +++ b/u18.04-n3.34-w1.12.6/at/Makefile @@ -0,0 +1,89 @@ +# Copyright (C) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) +# +# Adapted from Michael B. Porter +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# +# To install the Acoustics Toolbox: +# +# 1) Uncomment the appropriate lines below to select your FORTRAN compiler +# (also be sure to comment out all of the lines corresponding to the other compilers). + +# 2) If you're using gfortran check the -march switch that selects the chip you're using. +# Usually -march=native works + +# 3) From a command line shell, run: +# % make clean +# % make + +# on some machines you need to say -mcmodel=medium (or large) to allow for variables larger than 2 gig + +# ______________________________________________________________________________ + +# *** GNU Compiler Collection GFORTRAN +export FC=gfortran +export FFLAGS= -march=native -Bstatic -Waliasing -Wampersand -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -std=gnu -O1 -ffast-math -funroll-all-loops -fomit-frame-pointer -mtune=native +export RM=rm +export CC=gcc +export CFLAGS=-g +export FFLAGS+= -I../misc -I../tslib +export LAPACK_LIBS = -llapack + +all: + (cd misc; make -k all) + (cd tslib; make -k all) + (cd Bellhop; make -k all) + (cd Kraken; make -k all) + (cd KrakenField; make -k all) + # (cd Krakel; make -k all) + (cd Scooter; make -k all) + @echo " " + @echo "***********************************" + @echo "***** Acoustics Toolbox built *****" + @echo "***********************************" + +install: + (cd misc; make -k all) + (cd tslib; make -k all) + (cd Bellhop; make -k install) + (cd Kraken; make -k install) + (cd KrakenField; make -k install) + # (cd Krakel; make -k install) + (cd Scooter; make -k install) + @echo " " + @echo "***************************************" + @echo "***** Acoustics Toolbox installed *****" + @echo "***************************************" + +clean: + -rm -f bin/*.exe + find . -name '*.dSYM' -exec rm -r {} + + find . -name '*.png' -exec rm -r {} + + find . -name '*.eps' -exec rm -r {} + + find . -name '*.mod' -exec rm -r {} + + find . -name '*.grn' -exec rm -r {} + + find . -name '*.shd' -exec rm -r {} + + find . -name '*.shd.mat' -exec rm -r {} + + find . -name '*.prt' -exec rm -r {} + + (cd misc; make -k -i clean) + (cd tslib; make -k -i clean) + (cd Bellhop; make -k -i clean) + (cd Kraken; make -k -i clean) + (cd KrakenField; make -k -i clean) + (cd Krakel; make -k -i clean) + (cd Scooter; make -k -i clean) + (cd tests; make -k -i clean) + diff --git a/u18.04-n3.34-w1.12.6/ns3-build/build-debug.sh b/u18.04-n3.34-w1.12.6/ns3-build/build-debug.sh new file mode 100644 index 0000000..3d26844 --- /dev/null +++ b/u18.04-n3.34-w1.12.6/ns3-build/build-debug.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +NS3_DIR=${NS3_DEBUG_DIR} + +echo "Switching to debug profile in ns-3..." + +cd $NS3_DIR + +NS3_CONFIG="--build-profile=debug --out=build --enable-examples --enable-tests" +WOSS_CONFIG="--with-woss-source=${WOSS_LIB_SRC} --with-woss-library=${WOSS_LIB_DIR} --with-netcdf4-install=${WOSS_REQS_DIR}" + +. ${NS3_PY_ENV}/bin/activate + +OUTCOME=1 +CXXFLAGS="${CXX_CONFIG}" ./waf configure $WOSS_CONFIG $NS3_CONFIG && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: configuration failed" + exit 1 +fi + +OUTCOME=1 +./waf build && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: build failed" + exit 1 +fi + +./waf --check-profile +deactivate + +sed -i 's/^\(export NS3_CURR_PROFILE=\).*$/\1${NS3_DEBUG_DIR}/' ~/.bashrc && \ +cd /home && \ +kill -USR1 $PPID + +exit 0 diff --git a/u18.04-n3.34-w1.12.6/ns3-build/build-optimized.sh b/u18.04-n3.34-w1.12.6/ns3-build/build-optimized.sh new file mode 100644 index 0000000..20138a4 --- /dev/null +++ b/u18.04-n3.34-w1.12.6/ns3-build/build-optimized.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# MIT License + +# Copyright (c) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +NS3_DIR=${NS3_OPTIMIZED_DIR} + +echo "Switching to optimized profile in ns-3..." + +cd $NS3_DIR + +NS3_CONFIG="--build-profile=optimized --out=build --enable-examples --enable-tests" +WOSS_CONFIG="--with-woss-source=${WOSS_LIB_SRC} --with-woss-library=${WOSS_LIB_DIR} --with-netcdf4-install=${WOSS_REQS_DIR}" +CXX_CONFIG="-Wall" + +. ${NS3_PY_ENV}/bin/activate + +OUTCOME=1 +CXXFLAGS="${CXX_CONFIG}" ./waf configure $WOSS_CONFIG $NS3_CONFIG && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: configuration failed" + exit 1 +fi + +OUTCOME=1 +./waf build && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: build failed" + exit 1 +fi + +./waf --check-profile +deactivate + +sed -i 's/^\(export NS3_CURR_PROFILE=\).*$/\1${NS3_OPTIMIZED_DIR}/' ~/.bashrc && \ +cd /home && \ +kill -USR1 $PPID + +exit 0 diff --git a/u18.04-n3.34-w1.12.6/ns3-utils/Makefile b/u18.04-n3.34-w1.12.6/ns3-utils/Makefile new file mode 100644 index 0000000..1ecc311 --- /dev/null +++ b/u18.04-n3.34-w1.12.6/ns3-utils/Makefile @@ -0,0 +1,182 @@ +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +CWD := $(CURDIR) + +.ONESHELL: + +help: + @echo "Usage: make target [arguments]" + @echo "Targets:" + @echo " - help\n\tShows this help message." + @echo " --- Builds profiles ---" + @echo " - show_profile\n\tShows the ns-3 build profile currently in use." + @echo " --- Simulation driver programs ---" + @echo " - compile FILE=\n\tCopies the given driver program, then uses ./waf to compile it against ns-3." + @echo " - build_run FILE= [ARGS=] [LOG=]\n\tBuilds and executes the given driver program." + @echo " - run FILE= [ARGS=] [LOG=]\n\tExecutes the given driver program (no building first)." + @echo " - clean FILE=\n\tDeletes the given driver program." + @echo " --- Modules ---" + @echo " - new_module FILE=\n\tUses a ns-3 utility to create a new module under 'contrib/' with the given name, also copying it locally." + @echo " - sync_module FILE=\n\tReplaces contents of the module under 'contrib/' with local contents." + @echo " - rm_module FILE=\n\tRemoves the module with the given name (placed under 'contrib/')." + @echo " --- Debug ---" + @echo " - valgrind FILE= LOG=\n\tRuns the driver program through the Valgrind memory checking tool, writing the log to a file." + @echo " - gdb FILE=\n\tRuns the driver program through the GNU debugger." + @echo " - test SUITE= [LOG=]\n\tRuns the ns-3 testing tool selecting the given test suite." + @echo " - gdb_test SUITE=\n\tRuns the ns-3 testing tool selecting the given test suite, through the GNU debugger." + +show_profile: + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --check-profile + @deactivate + +compile: +ifeq ($(FILE),) + $(error 'compile' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Compiling..." + @cp -f $(FILE) $(NS3_CURR_PROFILE)/scratch/ + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf + @deactivate + @echo " Done." + +build_run: +ifeq ($(FILE),) + $(error 'build_run' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " $(shell date): running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./waf --run scratch/$(FILE) --command-template="%s $(ARGS)" +else + @./waf --run scratch/$(FILE) --command-template="%s $(ARGS)" >> $(LOG) 2>&1 +endif + @deactivate + @echo " $(shell date): done." + +run: +ifeq ($(FILE),) + $(error 'run' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " $(shell date): running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./waf --run-no-build scratch/$(FILE) --command-template="%s $(ARGS)" +else + @./waf --run-no-build scratch/$(FILE) --command-template="%s $(ARGS)" >> $(LOG) 2>&1 +endif + @deactivate + @echo " $(shell date): done." + +clean: +ifeq ($(FILE),) + $(error 'clean' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Cleaning..." + @cd $(NS3_CURR_PROFILE) + @rm scratch/$(FILE) + @echo " Done." + +new_module: +ifeq ($(FILE),) + $(error 'new_module' target requires a FILE variable with the new module's name) +endif + @echo " Creating new module $(NS3_CURR_PROFILE)/contrib/$(FILE)..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./utils/create-module.py contrib/$(FILE) + @cd $(CWD) + @cp -rf $(NS3_CURR_PROFILE)/contrib/$(FILE) $(FILE)/ + @deactivate + @echo " Done." + +rm_module: +ifeq ($(FILE),) + $(error 'rm_module' target requires a FILE variable with the module's name) +endif + @echo " Removing module contrib/$(FILE)..." + @rm -rf $(NS3_CURR_PROFILE)/contrib/$(FILE) + @echo " Done." + +sync_module: +ifeq ($(FILE),) + $(error 'sync_module' target requires a FILE variable with the module's name) +endif + @echo " Syncronizing module..." + @make rm_module FILE=$(FILE) + @cp -rf $(FILE)/ $(NS3_CURR_PROFILE)/contrib/ + @echo " Done." + +valgrind: +ifeq ($(FILE),) + $(error 'valgrind' target requires a FILE variable with the ns-3 driver program name) +endif +ifeq ($(LOG),) + $(error 'valgrind' target requires a LOG variable with the path to the log file) +endif + @echo " Running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --run scratch/$(FILE) --command-template="valgrind --leak-check=full --show-leak-kinds=all --log-file=$(LOG) %s" + @deactivate + @echo " Done." + +gdb: +ifeq ($(FILE),) + $(error 'gdb' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --run scratch/$(FILE) --command-template="gdb %s" + @deactivate + @echo " Done." + +test: +ifeq ($(SUITE),) + $(error 'test' target requires a SUITE variable with the ns-3 test suite name) +endif + @echo " Testing..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./test.py -n -s $(SUITE) +else + @./test.py -n -s $(SUITE) --text=$(LOG) +endif + @deactivate + @echo " Done." + +gdb_test: + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --run test-runner --command-template="gdb %s" + @deactivate + +.PHONY: clean diff --git a/u18.04-n3.35-w1.12.6/Dockerfile b/u18.04-n3.35-w1.12.6/Dockerfile new file mode 100644 index 0000000..93e8d6e --- /dev/null +++ b/u18.04-n3.35-w1.12.6/Dockerfile @@ -0,0 +1,109 @@ +# syntax=docker/dockerfile:1 + +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +FROM egiona/ns3-base:u18.04-n3.35 + +LABEL maintainer="giona.emanuele@gmail.com" +LABEL version="0.1" +LABEL description="ns3-base:u18.04-n3.35 and WOSS 1.12.6" + +ARG WOSS_VER="1.12.6" +ARG TMP_DOWNLOAD_DIR="/home/downloads" +ARG WOSS_LIB_BASE="/home/woss" + +# ===== Evinronment variables available in containers too ===== +# ns3-base provides the following environment variables already: +# - NS3_DEBUG_DIR: installation directory for ns-3 in 'debug' profile +# - NS3_OPTIMIZED_DIR: installation directory for ns-3 in 'optimized' profile +# - NS3_PY_ENV: ns-3 dedicated Python 3 environment + +# WOSS-related variables +ENV WOSS_LIB_SRC="$WOSS_LIB_BASE/WOSS-$WOSS_VER" +ENV WOSS_LIB_DIR="/home/woss_lib" +ENV WOSS_REQS_DIR="/home/woss_reqs" + +# ===== Basic OS updates and ns-3 requirements ===== +ARG DEBIAN_FRONTEND=noninteractive +RUN apt -y update && apt -y upgrade && \ +# ===== Downloading: WOSS requirements and library ===== + cd /home && mkdir "$TMP_DOWNLOAD_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + # WOSS requirements + mkdir "$WOSS_LIB_BASE" && mkdir "$WOSS_REQS_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + wget http://oalib.hlsresearch.com/AcousticsToolbox/at_2023_5_18.zip && \ + unzip at_2023_5_18.zip && rm at/Makefile && mv at "$WOSS_REQS_DIR/" && \ + wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_14_2.tar.gz && \ + tar -xf hdf5-1_14_2.tar.gz && \ + wget https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netcdf-c-4.9.2.tar.gz && \ + tar -xf netcdf-c-4.9.2.tar.gz && \ + wget https://downloads.unidata.ucar.edu/netcdf-cxx/4.3.1/netcdf-cxx4-4.3.1.tar.gz && \ + tar -xf netcdf-cxx4-4.3.1.tar.gz && \ + # WOSS library source and ns-3 module + wget "https://github.com/signetlabdei/WOSS/archive/refs/tags/$WOSS_VER.tar.gz" && \ + tar -xf "$WOSS_VER.tar.gz" && mv "WOSS-$WOSS_VER" "$WOSS_LIB_BASE" && \ + wget "https://github.com/MetalKnight/woss-ns3/archive/refs/tags/v$WOSS_VER.tar.gz" && \ + tar -xf "v$WOSS_VER.tar.gz" && mv "woss-ns3-$WOSS_VER" "$WOSS_LIB_BASE" + +# ===== Installing: WOSS requirements and WOSS library ===== +COPY at/Makefile "$WOSS_REQS_DIR/at/" +RUN cd "$WOSS_REQS_DIR/at" && \ + make clean && make && \ + echo "export PATH=$PATH:$WOSS_REQS_DIR/at/Bellhop/" >> ~/.bashrc && \ + # HDF5 + cd "$TMP_DOWNLOAD_DIR" && cd hdf5-hdf5-1_14_2 && \ + ./configure --enable-shared --prefix="$WOSS_REQS_DIR" && \ + make && make install && \ + # NetCDF-C + cd ../netcdf-c-4.9.2 && \ + ./configure --prefix="$WOSS_REQS_DIR" --enable-netcdf-4 --enable-shared --disable-dap --disable-byterange CPPFLAGS="$CPPFLAGS -I$WOSS_REQS_DIR/include" LDFLAGS="$LDFLAGS -L$WOSS_REQS_DIR/lib" && \ + make && make install && \ + # NetCDF-C++ + cd ../netcdf-cxx4-4.3.1 && \ + ./configure --prefix="$WOSS_REQS_DIR" --enable-shared CPPFLAGS="$CPPFLAGS -I$WOSS_REQS_DIR/include" LDFLAGS="$LDFLAGS -L$WOSS_REQS_DIR/lib" && \ + make && make install && \ + # WOSS library + mkdir "$WOSS_LIB_DIR" && cd "$WOSS_LIB_SRC" && \ + ./autogen.sh && ./configure --with-netcdf4="$WOSS_REQS_DIR" --with-pthread --prefix="$WOSS_LIB_DIR" && \ + make && make install + +# ===== Building: ns-3 with WOSS; Cleanup: temporary downloads directory ===== +ENV WOSS_LIB_DIR="/home/woss_lib/lib" +ENV CXX_CONFIG="-Wall -Werror -Wno-unused-variable" + +COPY ns3-build/* ns3-utils/* /home/ +RUN cd /home && \ + # Build: debug + cp -R "$WOSS_LIB_BASE/woss-ns3-$WOSS_VER/" "$NS3_DEBUG_DIR/src/" && \ + mv "$NS3_DEBUG_DIR/src/woss-ns3-$WOSS_VER" "$NS3_DEBUG_DIR/src/woss-ns3" && \ + chmod +x build-debug.sh && ./build-debug.sh && \ + # Build: optimized + cp -R "$WOSS_LIB_BASE/woss-ns3-$WOSS_VER/" "$NS3_OPTIMIZED_DIR/src/" && \ + mv "$NS3_OPTIMIZED_DIR/src/woss-ns3-$WOSS_VER" "$NS3_OPTIMIZED_DIR/src/woss-ns3" && \ + chmod +x build-optimized.sh && ./build-optimized.sh && \ + # Utility for switching between profiles + # [ ns3-base already provides the .bashrc signal trap ] + # Cleanup + rm -rf "$TMP_DOWNLOAD_DIR" && ./build-debug.sh + +CMD ["/bin/bash"] diff --git a/u18.04-n3.35-w1.12.6/at/Makefile b/u18.04-n3.35-w1.12.6/at/Makefile new file mode 100644 index 0000000..3dd8a90 --- /dev/null +++ b/u18.04-n3.35-w1.12.6/at/Makefile @@ -0,0 +1,89 @@ +# Copyright (C) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) +# +# Adapted from Michael B. Porter +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# +# To install the Acoustics Toolbox: +# +# 1) Uncomment the appropriate lines below to select your FORTRAN compiler +# (also be sure to comment out all of the lines corresponding to the other compilers). + +# 2) If you're using gfortran check the -march switch that selects the chip you're using. +# Usually -march=native works + +# 3) From a command line shell, run: +# % make clean +# % make + +# on some machines you need to say -mcmodel=medium (or large) to allow for variables larger than 2 gig + +# ______________________________________________________________________________ + +# *** GNU Compiler Collection GFORTRAN +export FC=gfortran +export FFLAGS= -march=native -Bstatic -Waliasing -Wampersand -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -std=gnu -O1 -ffast-math -funroll-all-loops -fomit-frame-pointer -mtune=native +export RM=rm +export CC=gcc +export CFLAGS=-g +export FFLAGS+= -I../misc -I../tslib +export LAPACK_LIBS = -llapack + +all: + (cd misc; make -k all) + (cd tslib; make -k all) + (cd Bellhop; make -k all) + (cd Kraken; make -k all) + (cd KrakenField; make -k all) + # (cd Krakel; make -k all) + (cd Scooter; make -k all) + @echo " " + @echo "***********************************" + @echo "***** Acoustics Toolbox built *****" + @echo "***********************************" + +install: + (cd misc; make -k all) + (cd tslib; make -k all) + (cd Bellhop; make -k install) + (cd Kraken; make -k install) + (cd KrakenField; make -k install) + # (cd Krakel; make -k install) + (cd Scooter; make -k install) + @echo " " + @echo "***************************************" + @echo "***** Acoustics Toolbox installed *****" + @echo "***************************************" + +clean: + -rm -f bin/*.exe + find . -name '*.dSYM' -exec rm -r {} + + find . -name '*.png' -exec rm -r {} + + find . -name '*.eps' -exec rm -r {} + + find . -name '*.mod' -exec rm -r {} + + find . -name '*.grn' -exec rm -r {} + + find . -name '*.shd' -exec rm -r {} + + find . -name '*.shd.mat' -exec rm -r {} + + find . -name '*.prt' -exec rm -r {} + + (cd misc; make -k -i clean) + (cd tslib; make -k -i clean) + (cd Bellhop; make -k -i clean) + (cd Kraken; make -k -i clean) + (cd KrakenField; make -k -i clean) + (cd Krakel; make -k -i clean) + (cd Scooter; make -k -i clean) + (cd tests; make -k -i clean) + diff --git a/u18.04-n3.35-w1.12.6/ns3-build/build-debug.sh b/u18.04-n3.35-w1.12.6/ns3-build/build-debug.sh new file mode 100644 index 0000000..3d26844 --- /dev/null +++ b/u18.04-n3.35-w1.12.6/ns3-build/build-debug.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +NS3_DIR=${NS3_DEBUG_DIR} + +echo "Switching to debug profile in ns-3..." + +cd $NS3_DIR + +NS3_CONFIG="--build-profile=debug --out=build --enable-examples --enable-tests" +WOSS_CONFIG="--with-woss-source=${WOSS_LIB_SRC} --with-woss-library=${WOSS_LIB_DIR} --with-netcdf4-install=${WOSS_REQS_DIR}" + +. ${NS3_PY_ENV}/bin/activate + +OUTCOME=1 +CXXFLAGS="${CXX_CONFIG}" ./waf configure $WOSS_CONFIG $NS3_CONFIG && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: configuration failed" + exit 1 +fi + +OUTCOME=1 +./waf build && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: build failed" + exit 1 +fi + +./waf --check-profile +deactivate + +sed -i 's/^\(export NS3_CURR_PROFILE=\).*$/\1${NS3_DEBUG_DIR}/' ~/.bashrc && \ +cd /home && \ +kill -USR1 $PPID + +exit 0 diff --git a/u18.04-n3.35-w1.12.6/ns3-build/build-optimized.sh b/u18.04-n3.35-w1.12.6/ns3-build/build-optimized.sh new file mode 100644 index 0000000..20138a4 --- /dev/null +++ b/u18.04-n3.35-w1.12.6/ns3-build/build-optimized.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# MIT License + +# Copyright (c) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +NS3_DIR=${NS3_OPTIMIZED_DIR} + +echo "Switching to optimized profile in ns-3..." + +cd $NS3_DIR + +NS3_CONFIG="--build-profile=optimized --out=build --enable-examples --enable-tests" +WOSS_CONFIG="--with-woss-source=${WOSS_LIB_SRC} --with-woss-library=${WOSS_LIB_DIR} --with-netcdf4-install=${WOSS_REQS_DIR}" +CXX_CONFIG="-Wall" + +. ${NS3_PY_ENV}/bin/activate + +OUTCOME=1 +CXXFLAGS="${CXX_CONFIG}" ./waf configure $WOSS_CONFIG $NS3_CONFIG && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: configuration failed" + exit 1 +fi + +OUTCOME=1 +./waf build && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: build failed" + exit 1 +fi + +./waf --check-profile +deactivate + +sed -i 's/^\(export NS3_CURR_PROFILE=\).*$/\1${NS3_OPTIMIZED_DIR}/' ~/.bashrc && \ +cd /home && \ +kill -USR1 $PPID + +exit 0 diff --git a/u18.04-n3.35-w1.12.6/ns3-utils/Makefile b/u18.04-n3.35-w1.12.6/ns3-utils/Makefile new file mode 100644 index 0000000..1ecc311 --- /dev/null +++ b/u18.04-n3.35-w1.12.6/ns3-utils/Makefile @@ -0,0 +1,182 @@ +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +CWD := $(CURDIR) + +.ONESHELL: + +help: + @echo "Usage: make target [arguments]" + @echo "Targets:" + @echo " - help\n\tShows this help message." + @echo " --- Builds profiles ---" + @echo " - show_profile\n\tShows the ns-3 build profile currently in use." + @echo " --- Simulation driver programs ---" + @echo " - compile FILE=\n\tCopies the given driver program, then uses ./waf to compile it against ns-3." + @echo " - build_run FILE= [ARGS=] [LOG=]\n\tBuilds and executes the given driver program." + @echo " - run FILE= [ARGS=] [LOG=]\n\tExecutes the given driver program (no building first)." + @echo " - clean FILE=\n\tDeletes the given driver program." + @echo " --- Modules ---" + @echo " - new_module FILE=\n\tUses a ns-3 utility to create a new module under 'contrib/' with the given name, also copying it locally." + @echo " - sync_module FILE=\n\tReplaces contents of the module under 'contrib/' with local contents." + @echo " - rm_module FILE=\n\tRemoves the module with the given name (placed under 'contrib/')." + @echo " --- Debug ---" + @echo " - valgrind FILE= LOG=\n\tRuns the driver program through the Valgrind memory checking tool, writing the log to a file." + @echo " - gdb FILE=\n\tRuns the driver program through the GNU debugger." + @echo " - test SUITE= [LOG=]\n\tRuns the ns-3 testing tool selecting the given test suite." + @echo " - gdb_test SUITE=\n\tRuns the ns-3 testing tool selecting the given test suite, through the GNU debugger." + +show_profile: + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --check-profile + @deactivate + +compile: +ifeq ($(FILE),) + $(error 'compile' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Compiling..." + @cp -f $(FILE) $(NS3_CURR_PROFILE)/scratch/ + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf + @deactivate + @echo " Done." + +build_run: +ifeq ($(FILE),) + $(error 'build_run' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " $(shell date): running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./waf --run scratch/$(FILE) --command-template="%s $(ARGS)" +else + @./waf --run scratch/$(FILE) --command-template="%s $(ARGS)" >> $(LOG) 2>&1 +endif + @deactivate + @echo " $(shell date): done." + +run: +ifeq ($(FILE),) + $(error 'run' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " $(shell date): running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./waf --run-no-build scratch/$(FILE) --command-template="%s $(ARGS)" +else + @./waf --run-no-build scratch/$(FILE) --command-template="%s $(ARGS)" >> $(LOG) 2>&1 +endif + @deactivate + @echo " $(shell date): done." + +clean: +ifeq ($(FILE),) + $(error 'clean' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Cleaning..." + @cd $(NS3_CURR_PROFILE) + @rm scratch/$(FILE) + @echo " Done." + +new_module: +ifeq ($(FILE),) + $(error 'new_module' target requires a FILE variable with the new module's name) +endif + @echo " Creating new module $(NS3_CURR_PROFILE)/contrib/$(FILE)..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./utils/create-module.py contrib/$(FILE) + @cd $(CWD) + @cp -rf $(NS3_CURR_PROFILE)/contrib/$(FILE) $(FILE)/ + @deactivate + @echo " Done." + +rm_module: +ifeq ($(FILE),) + $(error 'rm_module' target requires a FILE variable with the module's name) +endif + @echo " Removing module contrib/$(FILE)..." + @rm -rf $(NS3_CURR_PROFILE)/contrib/$(FILE) + @echo " Done." + +sync_module: +ifeq ($(FILE),) + $(error 'sync_module' target requires a FILE variable with the module's name) +endif + @echo " Syncronizing module..." + @make rm_module FILE=$(FILE) + @cp -rf $(FILE)/ $(NS3_CURR_PROFILE)/contrib/ + @echo " Done." + +valgrind: +ifeq ($(FILE),) + $(error 'valgrind' target requires a FILE variable with the ns-3 driver program name) +endif +ifeq ($(LOG),) + $(error 'valgrind' target requires a LOG variable with the path to the log file) +endif + @echo " Running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --run scratch/$(FILE) --command-template="valgrind --leak-check=full --show-leak-kinds=all --log-file=$(LOG) %s" + @deactivate + @echo " Done." + +gdb: +ifeq ($(FILE),) + $(error 'gdb' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --run scratch/$(FILE) --command-template="gdb %s" + @deactivate + @echo " Done." + +test: +ifeq ($(SUITE),) + $(error 'test' target requires a SUITE variable with the ns-3 test suite name) +endif + @echo " Testing..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./test.py -n -s $(SUITE) +else + @./test.py -n -s $(SUITE) --text=$(LOG) +endif + @deactivate + @echo " Done." + +gdb_test: + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./waf --run test-runner --command-template="gdb %s" + @deactivate + +.PHONY: clean diff --git a/u20.04-n3.40-w1.12.6/Dockerfile b/u20.04-n3.40-w1.12.6/Dockerfile new file mode 100644 index 0000000..3692f1d --- /dev/null +++ b/u20.04-n3.40-w1.12.6/Dockerfile @@ -0,0 +1,109 @@ +# syntax=docker/dockerfile:1 + +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +FROM egiona/ns3-base:u20.04-n3.40 + +LABEL maintainer="giona.emanuele@gmail.com" +LABEL version="0.1" +LABEL description="ns3-base:u20.04-n3.40 and WOSS 1.12.6" + +ARG WOSS_VER="1.12.6" +ARG TMP_DOWNLOAD_DIR="/home/downloads" +ARG WOSS_LIB_BASE="/home/woss" + +# ===== Evinronment variables available in containers too ===== +# ns3-base provides the following environment variables already: +# - NS3_DEBUG_DIR: installation directory for ns-3 in 'debug' profile +# - NS3_OPTIMIZED_DIR: installation directory for ns-3 in 'optimized' profile +# - NS3_PY_ENV: ns-3 dedicated Python 3 environment + +# WOSS-related variables +ENV WOSS_LIB_SRC="$WOSS_LIB_BASE/WOSS-$WOSS_VER" +ENV WOSS_LIB_DIR="/home/woss_lib" +ENV WOSS_REQS_DIR="/home/woss_reqs" + +# ===== Basic OS updates and ns-3 requirements ===== +ARG DEBIAN_FRONTEND=noninteractive +RUN apt -y update && apt -y upgrade && \ +# ===== Downloading: WOSS requirements and library ===== + cd /home && mkdir "$TMP_DOWNLOAD_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + # WOSS requirements + mkdir "$WOSS_LIB_BASE" && mkdir "$WOSS_REQS_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + wget http://oalib.hlsresearch.com/AcousticsToolbox/at_2023_5_18.zip && \ + unzip at_2023_5_18.zip && rm at/Makefile && mv at "$WOSS_REQS_DIR/" && \ + wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_14_2.tar.gz && \ + tar -xf hdf5-1_14_2.tar.gz && \ + wget https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netcdf-c-4.9.2.tar.gz && \ + tar -xf netcdf-c-4.9.2.tar.gz && \ + wget https://downloads.unidata.ucar.edu/netcdf-cxx/4.3.1/netcdf-cxx4-4.3.1.tar.gz && \ + tar -xf netcdf-cxx4-4.3.1.tar.gz && \ + # WOSS library source and ns-3 module + wget "https://github.com/signetlabdei/WOSS/archive/refs/tags/$WOSS_VER.tar.gz" && \ + tar -xf "$WOSS_VER.tar.gz" && mv "WOSS-$WOSS_VER" "$WOSS_LIB_BASE" && \ + wget "https://github.com/MetalKnight/woss-ns3/archive/refs/tags/v$WOSS_VER.tar.gz" && \ + tar -xf "v$WOSS_VER.tar.gz" && mv "woss-ns3-$WOSS_VER" "$WOSS_LIB_BASE" + +# ===== Installing: WOSS requirements and WOSS library ===== +COPY at/Makefile "$WOSS_REQS_DIR/at/" +RUN cd "$WOSS_REQS_DIR/at" && \ + make clean && make && \ + echo "export PATH=$PATH:$WOSS_REQS_DIR/at/Bellhop/" >> ~/.bashrc && \ + # HDF5 + cd "$TMP_DOWNLOAD_DIR" && cd hdf5-hdf5-1_14_2 && \ + ./configure --enable-shared --prefix="$WOSS_REQS_DIR" && \ + make && make install && \ + # NetCDF-C + cd ../netcdf-c-4.9.2 && \ + ./configure --prefix="$WOSS_REQS_DIR" --enable-netcdf-4 --enable-shared --disable-dap --disable-byterange CPPFLAGS="$CPPFLAGS -I$WOSS_REQS_DIR/include" LDFLAGS="$LDFLAGS -L$WOSS_REQS_DIR/lib" && \ + make && make install && \ + # NetCDF-C++ + cd ../netcdf-cxx4-4.3.1 && \ + ./configure --prefix="$WOSS_REQS_DIR" --enable-shared CPPFLAGS="$CPPFLAGS -I$WOSS_REQS_DIR/include" LDFLAGS="$LDFLAGS -L$WOSS_REQS_DIR/lib" && \ + make && make install && \ + # WOSS library + mkdir "$WOSS_LIB_DIR" && cd "$WOSS_LIB_SRC" && \ + ./autogen.sh && ./configure --with-netcdf4="$WOSS_REQS_DIR" --with-pthread --prefix="$WOSS_LIB_DIR" && \ + make && make install + +# ===== Building: ns-3 with WOSS; Cleanup: temporary downloads directory ===== +ENV WOSS_LIB_DIR="/home/woss_lib/lib" +ENV CXX_CONFIG="-Wall -Werror -Wno-unused-variable" + +COPY ns3-build/* ns3-utils/* /home/ +RUN cd /home && \ + # Build: debug + cp -R "$WOSS_LIB_BASE/woss-ns3-$WOSS_VER/" "$NS3_DEBUG_DIR/src/" && \ + mv "$NS3_DEBUG_DIR/src/woss-ns3-$WOSS_VER" "$NS3_DEBUG_DIR/src/woss-ns3" && \ + chmod +x build-debug.sh && ./build-debug.sh && \ + # Build: optimized + cp -R "$WOSS_LIB_BASE/woss-ns3-$WOSS_VER/" "$NS3_OPTIMIZED_DIR/src/" && \ + mv "$NS3_OPTIMIZED_DIR/src/woss-ns3-$WOSS_VER" "$NS3_OPTIMIZED_DIR/src/woss-ns3" && \ + chmod +x build-optimized.sh && ./build-optimized.sh && \ + # Utility for switching between profiles + # [ ns3-base already provides the .bashrc signal trap ] + # Cleanup + rm -rf "$TMP_DOWNLOAD_DIR" && ./build-debug.sh + +CMD ["/bin/bash"] diff --git a/u20.04-n3.40-w1.12.6/at/Makefile b/u20.04-n3.40-w1.12.6/at/Makefile new file mode 100644 index 0000000..3dd8a90 --- /dev/null +++ b/u20.04-n3.40-w1.12.6/at/Makefile @@ -0,0 +1,89 @@ +# Copyright (C) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) +# +# Adapted from Michael B. Porter +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# +# To install the Acoustics Toolbox: +# +# 1) Uncomment the appropriate lines below to select your FORTRAN compiler +# (also be sure to comment out all of the lines corresponding to the other compilers). + +# 2) If you're using gfortran check the -march switch that selects the chip you're using. +# Usually -march=native works + +# 3) From a command line shell, run: +# % make clean +# % make + +# on some machines you need to say -mcmodel=medium (or large) to allow for variables larger than 2 gig + +# ______________________________________________________________________________ + +# *** GNU Compiler Collection GFORTRAN +export FC=gfortran +export FFLAGS= -march=native -Bstatic -Waliasing -Wampersand -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -std=gnu -O1 -ffast-math -funroll-all-loops -fomit-frame-pointer -mtune=native +export RM=rm +export CC=gcc +export CFLAGS=-g +export FFLAGS+= -I../misc -I../tslib +export LAPACK_LIBS = -llapack + +all: + (cd misc; make -k all) + (cd tslib; make -k all) + (cd Bellhop; make -k all) + (cd Kraken; make -k all) + (cd KrakenField; make -k all) + # (cd Krakel; make -k all) + (cd Scooter; make -k all) + @echo " " + @echo "***********************************" + @echo "***** Acoustics Toolbox built *****" + @echo "***********************************" + +install: + (cd misc; make -k all) + (cd tslib; make -k all) + (cd Bellhop; make -k install) + (cd Kraken; make -k install) + (cd KrakenField; make -k install) + # (cd Krakel; make -k install) + (cd Scooter; make -k install) + @echo " " + @echo "***************************************" + @echo "***** Acoustics Toolbox installed *****" + @echo "***************************************" + +clean: + -rm -f bin/*.exe + find . -name '*.dSYM' -exec rm -r {} + + find . -name '*.png' -exec rm -r {} + + find . -name '*.eps' -exec rm -r {} + + find . -name '*.mod' -exec rm -r {} + + find . -name '*.grn' -exec rm -r {} + + find . -name '*.shd' -exec rm -r {} + + find . -name '*.shd.mat' -exec rm -r {} + + find . -name '*.prt' -exec rm -r {} + + (cd misc; make -k -i clean) + (cd tslib; make -k -i clean) + (cd Bellhop; make -k -i clean) + (cd Kraken; make -k -i clean) + (cd KrakenField; make -k -i clean) + (cd Krakel; make -k -i clean) + (cd Scooter; make -k -i clean) + (cd tests; make -k -i clean) + diff --git a/u20.04-n3.40-w1.12.6/ns3-build/build-debug.sh b/u20.04-n3.40-w1.12.6/ns3-build/build-debug.sh new file mode 100644 index 0000000..369988d --- /dev/null +++ b/u20.04-n3.40-w1.12.6/ns3-build/build-debug.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# MIT License + +# Copyright (c) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +NS3_DIR=${NS3_DEBUG_DIR} + +echo "Switching to debug profile in ns-3..." + +cd $NS3_DIR + +NS3_CONFIG="--build-profile=debug --out=build --enable-examples --enable-tests" +WOSS_CONFIG="-DNS3_WITH_WOSS_SOURCE=${WOSS_LIB_SRC} -DNS3_WITH_WOSS_LIBRARY=${WOSS_LIB_DIR} -DNS3_WITH_NETCDF4_INSTALL=${WOSS_REQS_DIR}" + +. ${NS3_PY_ENV}/bin/activate + +OUTCOME=1 +CXXFLAGS="${CXX_CONFIG}" ./ns3 configure $NS3_CONFIG -- $WOSS_CONFIG && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: configuration failed" + exit 1 +fi + +OUTCOME=1 +./ns3 build && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: build failed" + exit 1 +fi + +./ns3 show profile +deactivate + +sed -i 's/^\(export NS3_CURR_PROFILE=\).*$/\1${NS3_DEBUG_DIR}/' ~/.bashrc && \ +cd /home && \ +kill -USR1 $PPID + +exit 0 diff --git a/u20.04-n3.40-w1.12.6/ns3-build/build-optimized.sh b/u20.04-n3.40-w1.12.6/ns3-build/build-optimized.sh new file mode 100644 index 0000000..a861661 --- /dev/null +++ b/u20.04-n3.40-w1.12.6/ns3-build/build-optimized.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# MIT License + +# Copyright (c) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +NS3_DIR=${NS3_OPTIMIZED_DIR} + +echo "Switching to optimized profile in ns-3..." + +cd $NS3_DIR + +NS3_CONFIG="--build-profile=optimized --out=build --enable-examples --enable-tests" +WOSS_CONFIG="-DNS3_WITH_WOSS_SOURCE=${WOSS_LIB_SRC} -DNS3_WITH_WOSS_LIBRARY=${WOSS_LIB_DIR} -DNS3_WITH_NETCDF4_INSTALL=${WOSS_REQS_DIR}" +CXX_CONFIG="-Wall" + +. ${NS3_PY_ENV}/bin/activate + +OUTCOME=1 +CXXFLAGS="${CXX_CONFIG}" ./ns3 configure $NS3_CONFIG -- $WOSS_CONFIG && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: configuration failed" + exit 1 +fi + +OUTCOME=1 +./ns3 build && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: build failed" + exit 1 +fi + +./ns3 show profile +deactivate + +sed -i 's/^\(export NS3_CURR_PROFILE=\).*$/\1${NS3_OPTIMIZED_DIR}/' ~/.bashrc && \ +cd /home && \ +kill -USR1 $PPID + +exit 0 diff --git a/u20.04-n3.40-w1.12.6/ns3-utils/Makefile b/u20.04-n3.40-w1.12.6/ns3-utils/Makefile new file mode 100644 index 0000000..36ce95d --- /dev/null +++ b/u20.04-n3.40-w1.12.6/ns3-utils/Makefile @@ -0,0 +1,182 @@ +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +CWD := $(CURDIR) + +.ONESHELL: + +help: + @echo "Usage: make target [arguments]" + @echo "Targets:" + @echo " - help\n\tShows this help message." + @echo " --- Builds profiles ---" + @echo " - show_profile\n\tShows the ns-3 build profile currently in use." + @echo " --- Simulation driver programs ---" + @echo " - compile FILE=\n\tCopies the given driver program, then uses ./ns3 to compile it against ns-3." + @echo " - build_run FILE= [ARGS=] [LOG=]\n\tBuilds and executes the given driver program." + @echo " - run FILE= [ARGS=] [LOG=]\n\tExecutes the given driver program (no building first)." + @echo " - clean FILE=\n\tDeletes the given driver program." + @echo " --- Modules ---" + @echo " - new_module FILE=\n\tUses a ns-3 utility to create a new module under 'contrib/' with the given name, also copying it locally." + @echo " - sync_module FILE=\n\tReplaces contents of the module under 'contrib/' with local contents." + @echo " - rm_module FILE=\n\tRemoves the module with the given name (placed under 'contrib/')." + @echo " --- Debug ---" + @echo " - valgrind FILE= LOG=\n\tRuns the driver program through the Valgrind memory checking tool, writing the log to a file." + @echo " - gdb FILE=\n\tRuns the driver program through the GNU debugger." + @echo " - test SUITE= [LOG=]\n\tRuns the ns-3 testing tool selecting the given test suite." + @echo " - gdb_test SUITE=\n\tRuns the ns-3 testing tool selecting the given test suite, through the GNU debugger." + +show_profile: + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./ns3 show profile + @deactivate + +compile: +ifeq ($(FILE),) + $(error 'compile' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Compiling..." + @cp -f $(FILE) $(NS3_CURR_PROFILE)/scratch/ + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./ns3 + @deactivate + @echo " Done." + +build_run: +ifeq ($(FILE),) + $(error 'build_run' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " $(shell date): running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./ns3 run scratch/$(FILE) --command-template="%s $(ARGS)" +else + @./ns3 run scratch/$(FILE) --command-template="%s $(ARGS)" >> $(LOG) 2>&1 +endif + @deactivate + @echo " $(shell date): done." + +run: +ifeq ($(FILE),) + $(error 'run' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " $(shell date): running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./ns3 run scratch/$(FILE) --command-template="%s $(ARGS)" --no-build +else + @./ns3 run scratch/$(FILE) --command-template="%s $(ARGS)" --no-build >> $(LOG) 2>&1 +endif + @deactivate + @echo " $(shell date): done." + +clean: +ifeq ($(FILE),) + $(error 'clean' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Cleaning..." + @cd $(NS3_CURR_PROFILE) + @rm scratch/$(FILE) + @echo " Done." + +new_module: +ifeq ($(FILE),) + $(error 'new_module' target requires a FILE variable with the new module's name) +endif + @echo " Creating new module $(NS3_CURR_PROFILE)/contrib/$(FILE)..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./utils/create-module.py contrib/$(FILE) + @cd $(CWD) + @cp -rf $(NS3_CURR_PROFILE)/contrib/$(FILE) $(FILE)/ + @deactivate + @echo " Done." + +rm_module: +ifeq ($(FILE),) + $(error 'rm_module' target requires a FILE variable with the module's name) +endif + @echo " Removing module contrib/$(FILE)..." + @rm -rf $(NS3_CURR_PROFILE)/contrib/$(FILE) + @echo " Done." + +sync_module: +ifeq ($(FILE),) + $(error 'sync_module' target requires a FILE variable with the module's name) +endif + @echo " Syncronizing module..." + @make rm_module FILE=$(FILE) + @cp -rf $(FILE)/ $(NS3_CURR_PROFILE)/contrib/ + @echo " Done." + +valgrind: +ifeq ($(FILE),) + $(error 'valgrind' target requires a FILE variable with the ns-3 driver program name) +endif +ifeq ($(LOG),) + $(error 'valgrind' target requires a LOG variable with the path to the log file) +endif + @echo " Running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./ns3 run scratch/$(FILE) --command-template="valgrind --leak-check=full --show-leak-kinds=all --log-file=$(LOG) %s" + @deactivate + @echo " Done." + +gdb: +ifeq ($(FILE),) + $(error 'gdb' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./ns3 run scratch/$(FILE) --command-template="gdb %s" + @deactivate + @echo " Done." + +test: +ifeq ($(SUITE),) + $(error 'test' target requires a SUITE variable with the ns-3 test suite name) +endif + @echo " Testing..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./test.py -n -s $(SUITE) +else + @./test.py -n -s $(SUITE) --text=$(LOG) +endif + @deactivate + @echo " Done." + +gdb_test: + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./ns3 run test-runner --command-template="gdb %s" + @deactivate + +.PHONY: clean diff --git a/u22.04-n3.40-w1.12.6/Dockerfile b/u22.04-n3.40-w1.12.6/Dockerfile new file mode 100644 index 0000000..7f68ca7 --- /dev/null +++ b/u22.04-n3.40-w1.12.6/Dockerfile @@ -0,0 +1,109 @@ +# syntax=docker/dockerfile:1 + +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +FROM egiona/ns3-base:u22.04-n3.40 + +LABEL maintainer="giona.emanuele@gmail.com" +LABEL version="0.1" +LABEL description="ns3-base:u22.04-n3.40 and WOSS 1.12.6" + +ARG WOSS_VER="1.12.6" +ARG TMP_DOWNLOAD_DIR="/home/downloads" +ARG WOSS_LIB_BASE="/home/woss" + +# ===== Evinronment variables available in containers too ===== +# ns3-base provides the following environment variables already: +# - NS3_DEBUG_DIR: installation directory for ns-3 in 'debug' profile +# - NS3_OPTIMIZED_DIR: installation directory for ns-3 in 'optimized' profile +# - NS3_PY_ENV: ns-3 dedicated Python 3 environment + +# WOSS-related variables +ENV WOSS_LIB_SRC="$WOSS_LIB_BASE/WOSS-$WOSS_VER" +ENV WOSS_LIB_DIR="/home/woss_lib" +ENV WOSS_REQS_DIR="/home/woss_reqs" + +# ===== Basic OS updates and ns-3 requirements ===== +ARG DEBIAN_FRONTEND=noninteractive +RUN apt -y update && apt -y upgrade && \ +# ===== Downloading: WOSS requirements and library ===== + cd /home && mkdir "$TMP_DOWNLOAD_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + # WOSS requirements + mkdir "$WOSS_LIB_BASE" && mkdir "$WOSS_REQS_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + wget http://oalib.hlsresearch.com/AcousticsToolbox/at_2023_5_18.zip && \ + unzip at_2023_5_18.zip && rm at/Makefile && mv at "$WOSS_REQS_DIR/" && \ + wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_14_2.tar.gz && \ + tar -xf hdf5-1_14_2.tar.gz && \ + wget https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netcdf-c-4.9.2.tar.gz && \ + tar -xf netcdf-c-4.9.2.tar.gz && \ + wget https://downloads.unidata.ucar.edu/netcdf-cxx/4.3.1/netcdf-cxx4-4.3.1.tar.gz && \ + tar -xf netcdf-cxx4-4.3.1.tar.gz && \ + # WOSS library source and ns-3 module + wget "https://github.com/signetlabdei/WOSS/archive/refs/tags/$WOSS_VER.tar.gz" && \ + tar -xf "$WOSS_VER.tar.gz" && mv "WOSS-$WOSS_VER" "$WOSS_LIB_BASE" && \ + wget "https://github.com/MetalKnight/woss-ns3/archive/refs/tags/v$WOSS_VER.tar.gz" && \ + tar -xf "v$WOSS_VER.tar.gz" && mv "woss-ns3-$WOSS_VER" "$WOSS_LIB_BASE" + +# ===== Installing: WOSS requirements and WOSS library ===== +COPY at/Makefile "$WOSS_REQS_DIR/at/" +RUN cd "$WOSS_REQS_DIR/at" && \ + make clean && make && \ + echo "export PATH=$PATH:$WOSS_REQS_DIR/at/Bellhop/" >> ~/.bashrc && \ + # HDF5 + cd "$TMP_DOWNLOAD_DIR" && cd hdf5-hdf5-1_14_2 && \ + ./configure --enable-shared --prefix="$WOSS_REQS_DIR" && \ + make && make install && \ + # NetCDF-C + cd ../netcdf-c-4.9.2 && \ + ./configure --prefix="$WOSS_REQS_DIR" --enable-netcdf-4 --enable-shared --disable-dap --disable-byterange CPPFLAGS="$CPPFLAGS -I$WOSS_REQS_DIR/include" LDFLAGS="$LDFLAGS -L$WOSS_REQS_DIR/lib" && \ + make && make install && \ + # NetCDF-C++ + cd ../netcdf-cxx4-4.3.1 && \ + ./configure --prefix="$WOSS_REQS_DIR" --enable-shared CPPFLAGS="$CPPFLAGS -I$WOSS_REQS_DIR/include" LDFLAGS="$LDFLAGS -L$WOSS_REQS_DIR/lib" && \ + make && make install && \ + # WOSS library + mkdir "$WOSS_LIB_DIR" && cd "$WOSS_LIB_SRC" && \ + ./autogen.sh && ./configure --with-netcdf4="$WOSS_REQS_DIR" --with-pthread --prefix="$WOSS_LIB_DIR" && \ + make && make install + +# ===== Building: ns-3 with WOSS; Cleanup: temporary downloads directory ===== +ENV WOSS_LIB_DIR="/home/woss_lib/lib" +ENV CXX_CONFIG="-Wall -Werror -Wno-unused-variable" + +COPY ns3-build/* ns3-utils/* /home/ +RUN cd /home && \ + # Build: debug + cp -R "$WOSS_LIB_BASE/woss-ns3-$WOSS_VER/" "$NS3_DEBUG_DIR/src/" && \ + mv "$NS3_DEBUG_DIR/src/woss-ns3-$WOSS_VER" "$NS3_DEBUG_DIR/src/woss-ns3" && \ + chmod +x build-debug.sh && ./build-debug.sh && \ + # Build: optimized + cp -R "$WOSS_LIB_BASE/woss-ns3-$WOSS_VER/" "$NS3_OPTIMIZED_DIR/src/" && \ + mv "$NS3_OPTIMIZED_DIR/src/woss-ns3-$WOSS_VER" "$NS3_OPTIMIZED_DIR/src/woss-ns3" && \ + chmod +x build-optimized.sh && ./build-optimized.sh && \ + # Utility for switching between profiles + # [ ns3-base already provides the .bashrc signal trap ] + # Cleanup + rm -rf "$TMP_DOWNLOAD_DIR" && ./build-debug.sh + +CMD ["/bin/bash"] diff --git a/u22.04-n3.40-w1.12.6/at/Makefile b/u22.04-n3.40-w1.12.6/at/Makefile new file mode 100644 index 0000000..3dd8a90 --- /dev/null +++ b/u22.04-n3.40-w1.12.6/at/Makefile @@ -0,0 +1,89 @@ +# Copyright (C) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) +# +# Adapted from Michael B. Porter +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# +# To install the Acoustics Toolbox: +# +# 1) Uncomment the appropriate lines below to select your FORTRAN compiler +# (also be sure to comment out all of the lines corresponding to the other compilers). + +# 2) If you're using gfortran check the -march switch that selects the chip you're using. +# Usually -march=native works + +# 3) From a command line shell, run: +# % make clean +# % make + +# on some machines you need to say -mcmodel=medium (or large) to allow for variables larger than 2 gig + +# ______________________________________________________________________________ + +# *** GNU Compiler Collection GFORTRAN +export FC=gfortran +export FFLAGS= -march=native -Bstatic -Waliasing -Wampersand -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -std=gnu -O1 -ffast-math -funroll-all-loops -fomit-frame-pointer -mtune=native +export RM=rm +export CC=gcc +export CFLAGS=-g +export FFLAGS+= -I../misc -I../tslib +export LAPACK_LIBS = -llapack + +all: + (cd misc; make -k all) + (cd tslib; make -k all) + (cd Bellhop; make -k all) + (cd Kraken; make -k all) + (cd KrakenField; make -k all) + # (cd Krakel; make -k all) + (cd Scooter; make -k all) + @echo " " + @echo "***********************************" + @echo "***** Acoustics Toolbox built *****" + @echo "***********************************" + +install: + (cd misc; make -k all) + (cd tslib; make -k all) + (cd Bellhop; make -k install) + (cd Kraken; make -k install) + (cd KrakenField; make -k install) + # (cd Krakel; make -k install) + (cd Scooter; make -k install) + @echo " " + @echo "***************************************" + @echo "***** Acoustics Toolbox installed *****" + @echo "***************************************" + +clean: + -rm -f bin/*.exe + find . -name '*.dSYM' -exec rm -r {} + + find . -name '*.png' -exec rm -r {} + + find . -name '*.eps' -exec rm -r {} + + find . -name '*.mod' -exec rm -r {} + + find . -name '*.grn' -exec rm -r {} + + find . -name '*.shd' -exec rm -r {} + + find . -name '*.shd.mat' -exec rm -r {} + + find . -name '*.prt' -exec rm -r {} + + (cd misc; make -k -i clean) + (cd tslib; make -k -i clean) + (cd Bellhop; make -k -i clean) + (cd Kraken; make -k -i clean) + (cd KrakenField; make -k -i clean) + (cd Krakel; make -k -i clean) + (cd Scooter; make -k -i clean) + (cd tests; make -k -i clean) + diff --git a/u22.04-n3.40-w1.12.6/ns3-build/build-debug.sh b/u22.04-n3.40-w1.12.6/ns3-build/build-debug.sh new file mode 100644 index 0000000..369988d --- /dev/null +++ b/u22.04-n3.40-w1.12.6/ns3-build/build-debug.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# MIT License + +# Copyright (c) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +NS3_DIR=${NS3_DEBUG_DIR} + +echo "Switching to debug profile in ns-3..." + +cd $NS3_DIR + +NS3_CONFIG="--build-profile=debug --out=build --enable-examples --enable-tests" +WOSS_CONFIG="-DNS3_WITH_WOSS_SOURCE=${WOSS_LIB_SRC} -DNS3_WITH_WOSS_LIBRARY=${WOSS_LIB_DIR} -DNS3_WITH_NETCDF4_INSTALL=${WOSS_REQS_DIR}" + +. ${NS3_PY_ENV}/bin/activate + +OUTCOME=1 +CXXFLAGS="${CXX_CONFIG}" ./ns3 configure $NS3_CONFIG -- $WOSS_CONFIG && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: configuration failed" + exit 1 +fi + +OUTCOME=1 +./ns3 build && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: build failed" + exit 1 +fi + +./ns3 show profile +deactivate + +sed -i 's/^\(export NS3_CURR_PROFILE=\).*$/\1${NS3_DEBUG_DIR}/' ~/.bashrc && \ +cd /home && \ +kill -USR1 $PPID + +exit 0 diff --git a/u22.04-n3.40-w1.12.6/ns3-build/build-optimized.sh b/u22.04-n3.40-w1.12.6/ns3-build/build-optimized.sh new file mode 100644 index 0000000..a861661 --- /dev/null +++ b/u22.04-n3.40-w1.12.6/ns3-build/build-optimized.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +# MIT License + +# Copyright (c) 2023 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +NS3_DIR=${NS3_OPTIMIZED_DIR} + +echo "Switching to optimized profile in ns-3..." + +cd $NS3_DIR + +NS3_CONFIG="--build-profile=optimized --out=build --enable-examples --enable-tests" +WOSS_CONFIG="-DNS3_WITH_WOSS_SOURCE=${WOSS_LIB_SRC} -DNS3_WITH_WOSS_LIBRARY=${WOSS_LIB_DIR} -DNS3_WITH_NETCDF4_INSTALL=${WOSS_REQS_DIR}" +CXX_CONFIG="-Wall" + +. ${NS3_PY_ENV}/bin/activate + +OUTCOME=1 +CXXFLAGS="${CXX_CONFIG}" ./ns3 configure $NS3_CONFIG -- $WOSS_CONFIG && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: configuration failed" + exit 1 +fi + +OUTCOME=1 +./ns3 build && OUTCOME=0 + +if [[ "$OUTCOME" -eq 1 ]]; then + echo "Error: build failed" + exit 1 +fi + +./ns3 show profile +deactivate + +sed -i 's/^\(export NS3_CURR_PROFILE=\).*$/\1${NS3_OPTIMIZED_DIR}/' ~/.bashrc && \ +cd /home && \ +kill -USR1 $PPID + +exit 0 diff --git a/u22.04-n3.40-w1.12.6/ns3-utils/Makefile b/u22.04-n3.40-w1.12.6/ns3-utils/Makefile new file mode 100644 index 0000000..36ce95d --- /dev/null +++ b/u22.04-n3.40-w1.12.6/ns3-utils/Makefile @@ -0,0 +1,182 @@ +# MIT License + +# Copyright (c) 2024 Emanuele Giona (SENSES Lab, +# Sapienza University of Rome) + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +CWD := $(CURDIR) + +.ONESHELL: + +help: + @echo "Usage: make target [arguments]" + @echo "Targets:" + @echo " - help\n\tShows this help message." + @echo " --- Builds profiles ---" + @echo " - show_profile\n\tShows the ns-3 build profile currently in use." + @echo " --- Simulation driver programs ---" + @echo " - compile FILE=\n\tCopies the given driver program, then uses ./ns3 to compile it against ns-3." + @echo " - build_run FILE= [ARGS=] [LOG=]\n\tBuilds and executes the given driver program." + @echo " - run FILE= [ARGS=] [LOG=]\n\tExecutes the given driver program (no building first)." + @echo " - clean FILE=\n\tDeletes the given driver program." + @echo " --- Modules ---" + @echo " - new_module FILE=\n\tUses a ns-3 utility to create a new module under 'contrib/' with the given name, also copying it locally." + @echo " - sync_module FILE=\n\tReplaces contents of the module under 'contrib/' with local contents." + @echo " - rm_module FILE=\n\tRemoves the module with the given name (placed under 'contrib/')." + @echo " --- Debug ---" + @echo " - valgrind FILE= LOG=\n\tRuns the driver program through the Valgrind memory checking tool, writing the log to a file." + @echo " - gdb FILE=\n\tRuns the driver program through the GNU debugger." + @echo " - test SUITE= [LOG=]\n\tRuns the ns-3 testing tool selecting the given test suite." + @echo " - gdb_test SUITE=\n\tRuns the ns-3 testing tool selecting the given test suite, through the GNU debugger." + +show_profile: + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./ns3 show profile + @deactivate + +compile: +ifeq ($(FILE),) + $(error 'compile' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Compiling..." + @cp -f $(FILE) $(NS3_CURR_PROFILE)/scratch/ + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./ns3 + @deactivate + @echo " Done." + +build_run: +ifeq ($(FILE),) + $(error 'build_run' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " $(shell date): running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./ns3 run scratch/$(FILE) --command-template="%s $(ARGS)" +else + @./ns3 run scratch/$(FILE) --command-template="%s $(ARGS)" >> $(LOG) 2>&1 +endif + @deactivate + @echo " $(shell date): done." + +run: +ifeq ($(FILE),) + $(error 'run' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " $(shell date): running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./ns3 run scratch/$(FILE) --command-template="%s $(ARGS)" --no-build +else + @./ns3 run scratch/$(FILE) --command-template="%s $(ARGS)" --no-build >> $(LOG) 2>&1 +endif + @deactivate + @echo " $(shell date): done." + +clean: +ifeq ($(FILE),) + $(error 'clean' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Cleaning..." + @cd $(NS3_CURR_PROFILE) + @rm scratch/$(FILE) + @echo " Done." + +new_module: +ifeq ($(FILE),) + $(error 'new_module' target requires a FILE variable with the new module's name) +endif + @echo " Creating new module $(NS3_CURR_PROFILE)/contrib/$(FILE)..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./utils/create-module.py contrib/$(FILE) + @cd $(CWD) + @cp -rf $(NS3_CURR_PROFILE)/contrib/$(FILE) $(FILE)/ + @deactivate + @echo " Done." + +rm_module: +ifeq ($(FILE),) + $(error 'rm_module' target requires a FILE variable with the module's name) +endif + @echo " Removing module contrib/$(FILE)..." + @rm -rf $(NS3_CURR_PROFILE)/contrib/$(FILE) + @echo " Done." + +sync_module: +ifeq ($(FILE),) + $(error 'sync_module' target requires a FILE variable with the module's name) +endif + @echo " Syncronizing module..." + @make rm_module FILE=$(FILE) + @cp -rf $(FILE)/ $(NS3_CURR_PROFILE)/contrib/ + @echo " Done." + +valgrind: +ifeq ($(FILE),) + $(error 'valgrind' target requires a FILE variable with the ns-3 driver program name) +endif +ifeq ($(LOG),) + $(error 'valgrind' target requires a LOG variable with the path to the log file) +endif + @echo " Running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./ns3 run scratch/$(FILE) --command-template="valgrind --leak-check=full --show-leak-kinds=all --log-file=$(LOG) %s" + @deactivate + @echo " Done." + +gdb: +ifeq ($(FILE),) + $(error 'gdb' target requires a FILE variable with the ns-3 driver program name) +endif + @echo " Running..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./ns3 run scratch/$(FILE) --command-template="gdb %s" + @deactivate + @echo " Done." + +test: +ifeq ($(SUITE),) + $(error 'test' target requires a SUITE variable with the ns-3 test suite name) +endif + @echo " Testing..." + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) +ifeq ($(LOG),) + @./test.py -n -s $(SUITE) +else + @./test.py -n -s $(SUITE) --text=$(LOG) +endif + @deactivate + @echo " Done." + +gdb_test: + @. $(NS3_PY_ENV)/bin/activate + @cd $(NS3_CURR_PROFILE) + @./ns3 run test-runner --command-template="gdb %s" + @deactivate + +.PHONY: clean