From 70f48d4046751a06bc68632b6f5e0927c10decb3 Mon Sep 17 00:00:00 2001 From: Emanuele Giona Date: Wed, 11 Oct 2023 13:11:00 +0200 Subject: [PATCH] New images released; fixes issues related to GCC mismatch and WOSS/NetCDF --- CHANGELOG.md | 100 ++++++++++ README.md | 87 ++++---- download-databases.sh | 115 ----------- u18.04-n3.33-w1.12.5/Dockerfile | 144 ++++++++++++++ u18.04-n3.33-w1.12.5/at/Makefile | 89 +++++++++ u18.04-n3.33-w1.12.5/ns3-build/build-debug.sh | 60 ++++++ .../ns3-build/build-optimized.sh | 61 ++++++ u18.04-n3.33-w1.12.5/ns3-utils/Makefile | 185 ++++++++++++++++++ u18.04-n3.34-w1.12.5/Dockerfile | 144 ++++++++++++++ u18.04-n3.34-w1.12.5/at/Makefile | 89 +++++++++ u18.04-n3.34-w1.12.5/ns3-build/build-debug.sh | 60 ++++++ .../ns3-build/build-optimized.sh | 61 ++++++ u18.04-n3.34-w1.12.5/ns3-utils/Makefile | 185 ++++++++++++++++++ u18.04-n3.35-w1.12.5/Dockerfile | 144 ++++++++++++++ u18.04-n3.35-w1.12.5/at/Makefile | 89 +++++++++ u18.04-n3.35-w1.12.5/ns3-build/build-debug.sh | 60 ++++++ .../ns3-build/build-optimized.sh | 61 ++++++ u18.04-n3.35-w1.12.5/ns3-utils/Makefile | 185 ++++++++++++++++++ u20.04-n3.37-w1.12.5/Dockerfile | 144 ++++++++++++++ u20.04-n3.37-w1.12.5/at/Makefile | 89 +++++++++ u20.04-n3.37-w1.12.5/ns3-build/build-debug.sh | 60 ++++++ .../ns3-build/build-optimized.sh | 61 ++++++ u20.04-n3.37-w1.12.5/ns3-utils/Makefile | 185 ++++++++++++++++++ u20.04-n3.40-w1.12.5/Dockerfile | 144 ++++++++++++++ u20.04-n3.40-w1.12.5/at/Makefile | 89 +++++++++ u20.04-n3.40-w1.12.5/ns3-build/build-debug.sh | 60 ++++++ .../ns3-build/build-optimized.sh | 61 ++++++ u20.04-n3.40-w1.12.5/ns3-utils/Makefile | 185 ++++++++++++++++++ 28 files changed, 2838 insertions(+), 159 deletions(-) create mode 100644 CHANGELOG.md delete mode 100755 download-databases.sh create mode 100644 u18.04-n3.33-w1.12.5/Dockerfile create mode 100644 u18.04-n3.33-w1.12.5/at/Makefile create mode 100644 u18.04-n3.33-w1.12.5/ns3-build/build-debug.sh create mode 100644 u18.04-n3.33-w1.12.5/ns3-build/build-optimized.sh create mode 100644 u18.04-n3.33-w1.12.5/ns3-utils/Makefile create mode 100644 u18.04-n3.34-w1.12.5/Dockerfile create mode 100644 u18.04-n3.34-w1.12.5/at/Makefile create mode 100644 u18.04-n3.34-w1.12.5/ns3-build/build-debug.sh create mode 100644 u18.04-n3.34-w1.12.5/ns3-build/build-optimized.sh create mode 100644 u18.04-n3.34-w1.12.5/ns3-utils/Makefile create mode 100644 u18.04-n3.35-w1.12.5/Dockerfile create mode 100644 u18.04-n3.35-w1.12.5/at/Makefile create mode 100644 u18.04-n3.35-w1.12.5/ns3-build/build-debug.sh create mode 100644 u18.04-n3.35-w1.12.5/ns3-build/build-optimized.sh create mode 100644 u18.04-n3.35-w1.12.5/ns3-utils/Makefile create mode 100644 u20.04-n3.37-w1.12.5/Dockerfile create mode 100644 u20.04-n3.37-w1.12.5/at/Makefile create mode 100644 u20.04-n3.37-w1.12.5/ns3-build/build-debug.sh create mode 100644 u20.04-n3.37-w1.12.5/ns3-build/build-optimized.sh create mode 100644 u20.04-n3.37-w1.12.5/ns3-utils/Makefile create mode 100644 u20.04-n3.40-w1.12.5/Dockerfile create mode 100644 u20.04-n3.40-w1.12.5/at/Makefile create mode 100644 u20.04-n3.40-w1.12.5/ns3-build/build-debug.sh create mode 100644 u20.04-n3.40-w1.12.5/ns3-build/build-optimized.sh create mode 100644 u20.04-n3.40-w1.12.5/ns3-utils/Makefile diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b619327 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,100 @@ +# Changelog + +## Release v3.0.0 + +[Link to release][v300] + +**Users are urged to update to any of the images hereby released.** + +Introduced support to new OS, ns-3, and WOSS versions: + +- OS: Ubuntu 20.04 LTS + +- ns-3: 3.40 + +- WOSS: 1.12.5 + +Differently from previous releases, new images pair all supported ns-3 versions with WOSS 1.12.5. + +This release fixes these critical issues: + +- GCC version mismatch between WOSS requirements, WOSS library and ns-3 + + Starting from ns-3.36, GCC 8 became the minimum supported version. + More details can be found at [this page][gcc-8-issue]. + + Images released prior to v3.0.0 bundled ns-3.37 with WOSS using Ubuntu 18.04 LTS as base image, causing the issue. + Indeed, while ns-3 was being built with GCC 8, WOSS library and its dependencies were instead built and linked using the system-default GCC 7.5.0. + During simulation execution, segmentation faults were occurring due such mismatch in GCC versions. + + In order to fix this issue, upgrading to Ubuntu 20.04 LTS is a quick solution since the system-default GCC version is 9.3.0. + As a result, ns-3.37 images based on Ubuntu 18.04 should NOT be used, in favor of the hereby provided one, which is instead based on Ubuntu 20.04 LTS. + +- Situational WOSS crashes (due to HDF5 and/or NetCDF-C) + + WOSS users designing simulations with long running time and/or large networks might encounter crashes from the NetCDF library. + More details can be found at [this page][woss-netcdf-crash]. + + In order to fix this issue, upgrading all WOSS requirements to their latest versions proved to be a solution to this problem. + As a result, all images prior to v3.0.0 should NOT be used in case you encounter this problem during your WOSS-based simulations. + +Minor changes: + +- Instructions in each `Dockerfile` are re-arranged to reduce layers + +## Release v2.0.1 + +[Link to release][v201] + +Various updates to all supported images (revision `r2`): + +- improved `Dockerfile` with: parametrized ns-3 and WOSS versions, separation of `debug` and `optimized` build directories + +- uniformed functionality of scripts `build-debug.sh` and `build-optimized.sh` across ns-3 versions + +- introduced utility `Makefile` to images released in v1.0.0 + +## Release v1.1.0 + +[Link to release][v110] + +Introduced support to new ns-3 and WOSS versions: + +- ns-3: 3.37 + +- WOSS: 1.12.4 + +ns-3 adopted the CMake build system starting from 3.36 release. + +As a result, a new container filesystem has been designed, featuring separate ns-3 build directories depending on the profiles: `ns-3.37-debug` and `ns-3.37-optimized` directories respectively contain identical ns-3 source tree, permanently kept in their specific build profile. + +More details can be found at [this page][ns3-cmake]. + +## Release v1.0.0 + +[Link to release][v100] + +Initial release. + +Supported versions: + +- OS: Ubuntu 18.04 LTS + +- ns-3: from 3.33 to 3.35 + +- WOSS: from 1.12.0 to 1.12.2 + + + + +[v100]: https://github.com/SENSES-Lab-Sapienza/ns3-woss-docker/releases/tag/v1.0.0 +[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 +[v300]: https://github.com/SENSES-Lab-Sapienza/ns3-woss-docker/releases/tag/v3.0.0 + + +[ns3-cmake]: https://www.nsnam.org/docs/manual/html/working-with-cmake.html + + +[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 diff --git a/README.md b/README.md index 0f2f90c..8787ce2 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,15 @@ Docker image name: [**`egiona/ns3-woss`**][docker-hub-repo]. | Docker image tag | OS | ns-3 | Build system | WOSS | Dockerfile | | :---: | :---: | :---: | :---: | :---: | :---: | -| [`u18.04-n3.37-w1.12.4-r2`][image6] | Ubuntu 18.04 | [3.37][ns3.37] | CMake[^ns3-cmake] | [1.12.4][woss-changelog] | [link][file6] | -| [`u18.04-n3.35-w1.12.2-r2`][image5] | Ubuntu 18.04 | [3.35][ns3.35] | Waf | [1.12.2][woss-changelog] | [link][file5] | -| [`u18.04-n3.34-w1.12.2-r2`][image4] | Ubuntu 18.04 | [3.34][ns3.34] | Waf | [1.12.2][woss-changelog] | [link][file4] | -| [`u18.04-n3.34-w1.12.1-r2`][image3] | Ubuntu 18.04 | [3.34][ns3.34] | Waf | [1.12.1][woss-changelog] | [link][file3] | -| [`u18.04-n3.33-w1.12.1-r2`][image2] | Ubuntu 18.04 | [3.33][ns3.33] | Waf | [1.12.1][woss-changelog] | [link][file2] | -| [`u18.04-n3.33-w1.12.0-r2`][image1] | Ubuntu 18.04 | [3.33][ns3.33] | Waf | [1.12.0][woss-changelog] | [link][file1] | +| [`u20.04-n3.40-w1.12.5`][image5] | Ubuntu 20.04 | [3.40][ns3.40] | CMake | [1.12.5][woss-changelog] | [link][file5] | +| [`u20.04-n3.37-w1.12.5`][image4] | Ubuntu 20.04[^gcc-issue] | [3.37][ns3.37] | CMake[^ns3-cmake] | [1.12.5][woss-changelog] | [link][file4] | +| [`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] | + +Full changelog can be found at [this page](./CHANGELOG.md). + +[^gcc-issue]: ns-3.37 images based on Ubuntu 18.04 should NOT be used due an issue related to GCC version mismatch between builds for WOSS requirements and ns-3 itself. More details can be found at [this page](https://gitlab.com/nsnam/ns-3-dev/-/blob/ns-3.36/RELEASE_NOTES.md#release-336). [^ns3-cmake]: ns-3 adopted the CMake build system starting from 3.36 release. More details can be found at [this page](https://www.nsnam.org/docs/manual/html/working-with-cmake.html). @@ -86,25 +89,21 @@ However, _utility scripts_ are only provided for UNIX-like systems. ## Optional instructions -> As long as you `restart` the same container, any modification to its contents will be preserved. +> As long as you `docker restart` the same container, any modification to its contents will be preserved. However, it is advisable to keep a _local backup copy_ of your modules and experiment results. -1. Execute the utility script to download [WOSS][woss-dbs], [GEBCO 2020][gebco2020], and [GEBCO 2022 2D 15 arc-seconds][gebco2022] databases _locally_ using - - `./download-databases.sh ` - - _Were this utility to fail (or cannot be run due the lack of a UNIX-like system), download both databases via browser and use your favorite decompression tool on them._ +1. Download [WOSS databases][woss-dbs] (_required_), and optional bathymetry databases such as [GEBCO 2020][gebco2020], [GEBCO 2022][gebco2022] or [GEBCO 2023][gebco2023] _locally_. - _More specifically, the extracted_  `dbs` _directory should contain 4 sub-directories, namely:_  `bathymetry`_,_ `seafloor_sediment`_,_ `ssp`_, and_  `transducers`_._ - - _Once extracted, place the_  `GEBCO_XXXX.nc` _file under the_  `dbs/bathymetry/` _sub-directory._ + More specifically, the extracted `dbs` directory should contain 4 sub-directories, namely: `bathymetry`, `seafloor_sediment`, `ssp`, and `transducers`. + + For GEBCO databases users only, place the extracted `GEBCO_XXXX.nc` file under the `dbs/bathymetry/` sub-directory. + It is advisable to store these files outside the container filesystem and using the `docker mount` utility to use them for your simulations. + Please see below step 4. 2. Copy an arbitrary local file into the container's filesystem using `docker cp :` - _Be sure to use_  `/home/woss_reqs/` _as target container directory to copy the DBs directory into, then adapt ns-3 scripts to point to it._ - 3. Copy an arbitrary container's file to local filesystem using `docker cp : ` @@ -115,13 +114,13 @@ However, it is advisable to keep a _local backup copy_ of your modules and exper _Local path to be mounted must be absolute. The path within a container's filesystem is placed under its_  `/home/` _directory._ - _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._ + _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._ -5. Starting from `r2` images, an environment variables `CXX_CONFIG` is available for user-defined scripts to adapt their GCC compilation parameters; by default, such variable holds the following contents: +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](./u18.04-n3.37-w1.12.4-r2/ns3-build/) have been updated to provide an exit value reflective of ns-3's configuration and build outcome. + Moreover, [build scripts](./u20.04-n3.37-w1.12.4-r2/ns3-build/) have been updated to provide an exit value reflective of ns-3's configuration and build outcome. # Citing this work @@ -161,7 +160,7 @@ chosen for the Docker images does not necessarily apply to them. [ns3]: https://www.nsnam.org/ -[woss]: http://telecom.dei.unipd.it/ns/woss/ +[woss]: https://woss.dei.unipd.it/ [docker]: https://www.docker.com/ [woss-ns3]: https://github.com/MetalKnight/woss-ns3 @@ -171,34 +170,34 @@ chosen for the Docker images does not necessarily apply to them. [ns3.34]: https://www.nsnam.org/releases/ns-3-34/ [ns3.35]: https://www.nsnam.org/releases/ns-3-35/ [ns3.37]: https://www.nsnam.org/releases/ns-3-37/ - -[woss-changelog]: http://telecom.dei.unipd.it/ns/woss/doxygen/Changelog.html - -[latest-debug]: ./u18.04-n3.37-w1.12.4-r2/ns3-build/build-debug.sh -[latest-optimized]: ./u18.04-n3.37-w1.12.4-r2/ns3-build/build-optimized.sh -[latest-build]: ./u18.04-n3.37-w1.12.4-r2/ns3-build/ -[latest-makefile]: ./u18.04-n3.37-w1.12.4-r2/ns3-utils/Makefile - -[image6]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.37-w1.12.4-r2 -[image5]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.35-w1.12.2-r2 -[image4]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.34-w1.12.2-r2 -[image3]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.34-w1.12.1-r2 -[image2]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.33-w1.12.1-r2 -[image1]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u18.04-n3.33-w1.12.0-r2 -[file6]: ./u18.04-n3.37-w1.12.4-r2/Dockerfile -[file5]: ./u18.04-n3.35-w1.12.2-r2/Dockerfile -[file4]: ./u18.04-n3.34-w1.12.2-r2/Dockerfile -[file3]: ./u18.04-n3.34-w1.12.1-r2/Dockerfile -[file2]: ./u18.04-n3.33-w1.12.1-r2/Dockerfile -[file1]: ./u18.04-n3.33-w1.12.0-r2/Dockerfile +[ns3.40]: https://www.nsnam.org/releases/ns-3-40/ + +[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 +[image4]: https://hub.docker.com/r/egiona/ns3-woss/tags?page=1&name=u20.04-n3.37-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 +[file4]: ./u20.04-n3.37-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 [docker-install]: https://docs.docker.com/engine/install/ -[woss-dbs]: http://telecom.dei.unipd.it/ns/woss/files/WOSS-dbs-v1.6.0.tar.gz +[woss-dbs]: https://woss.dei.unipd.it/woss/files/WOSS-dbs-v1.6.0.tar.gz [gebco2020]: https://www.bodc.ac.uk/data/open_download/gebco/gebco_2020/zip/ [gebco2022]: https://www.bodc.ac.uk/data/open_download/gebco/gebco_2022/zip/ +[gebco2023]: https://www.bodc.ac.uk/data/open_download/gebco/gebco_2023/zip/ -[ns3-builds]: https://www.nsnam.org/docs/release/3.37/tutorial/html/getting-started.html#build-profiles +[ns3-builds]: https://www.nsnam.org/docs/release/3.40/tutorial/html/getting-started.html#build-profiles [cff]: https://citation-file-format.github.io/ [citation]: ./CITATION.cff @@ -206,4 +205,4 @@ chosen for the Docker images does not necessarily apply to them. [senseslab]: https://senseslab.diag.uniroma1.it/ [docker-license]: ./LICENSE [ns3-license]: https://www.nsnam.org/develop/contributing-code/licensing/ -[woss-license]: http://telecom.dei.unipd.it/ns/woss/doxygen/License.html +[woss-license]: https://woss.dei.unipd.it/woss/doxygen/License.html diff --git a/download-databases.sh b/download-databases.sh deleted file mode 100755 index e2862e0..0000000 --- a/download-databases.sh +++ /dev/null @@ -1,115 +0,0 @@ -#!/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. - -USAGE="Usage: ./$(basename "$0") - where: - - is the absolute path to the directory for downloading databases - - is the absolute path to the directory for storing databases" - -if [[ "$#" -ne 2 ]]; then - echo "Invalid argument number." - echo "${USAGE}" - exit 1 -fi - -if [ ! -d "${1}" ]; then - echo "Download directory does not exist." - echo "${USAGE}" - exit 1 -fi - -if [ ! -d "${2}" ]; then - echo "Databse directory does not exist." - echo "${USAGE}" - exit 1 -fi - -CURR_DIR=`pwd` -WOSS_DBS=0 -GEBCO_2020=0 -GEBCO_2022=0 - -echo "Entering ${1}" -cd ${1} - -echo "1/3: Downloading WOSS databases..." -wget http://telecom.dei.unipd.it/ns/woss/files/WOSS-dbs-v1.6.0.tar.gz && \ -tar -xf WOSS-dbs-v1.6.0.tar.gz && \ -rm WOSS-dbs-v1.6.0.tar.gz && \ -let WOSS_DBS=1 - -if [ ${WOSS_DBS} -ne 1 ]; then - echo "FAILED: exiting" - exit 1 -fi - -echo "2/3: Downloading GEBCO 2020 database..." -curl -L -o gebco_2020_netcdf.zip https://www.bodc.ac.uk/data/open_download/gebco/gebco_2020/zip/ && \ -unzip gebco_2020_netcdf.zip && \ -rm gebco_2020_netcdf.zip && \ -let GEBCO_2020=1 - -if [ ${GEBCO_2020} -ne 1 ]; then - echo "FAILED: exiting" - exit 1 -fi - -echo "3/3: Downloading GEBCO 2022 database..." -curl -L -o gebco_2022_netcdf.zip https://www.bodc.ac.uk/data/open_download/gebco/gebco_2022/zip/ && \ -unzip gebco_2022_netcdf.zip && \ -rm gebco_2022_netcdf.zip && \ -let GEBCO_2022=1 - -if [ ${GEBCO_2022} -ne 1 ]; then - echo "FAILED: exiting" - exit 1 -fi - -echo "All databases downloaded" -echo "Moving WOSS databases to ${2}..." - -cp -r --parents dbs/* ${2}/ - -if [ ! -d "${2}/dbs" ]; then - echo "FAILED: exiting ('dbs' directory missing)" - exit 1 -fi - -if [ ! -d "${2}/dbs/bathymetry" ]; then - echo "FAILED: exiting ('dbs/bathymetry' directory missing)." - exit 1 -fi - -echo "Moving GEBCO 2020 database..." -mv GEBCO_2020.nc ${2}/dbs/bathymetry/ - -echo "Moving GEBCO 2022 database..." -mv GEBCO_2022.nc ${2}/dbs/bathymetry/ - -cd ${CURR_DIR} - -echo "Done" -echo "All databases moved to: ${2}/dbs/" -exit 0 diff --git a/u18.04-n3.33-w1.12.5/Dockerfile b/u18.04-n3.33-w1.12.5/Dockerfile new file mode 100644 index 0000000..4e51d45 --- /dev/null +++ b/u18.04-n3.33-w1.12.5/Dockerfile @@ -0,0 +1,144 @@ +# syntax=docker/dockerfile:1 + +# 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. + +FROM ubuntu:18.04 + +LABEL maintainer="giona.emanuele@gmail.com" +LABEL version="0.1" +LABEL description="Ubuntu 18.04 with ns-3.33 and WOSS 1.12.5" + +ARG NS_ALLINONE="ns-allinone-3.33" +ARG NS_VER="ns-3.33" +ARG WOSS_VER="1.12.5" + +ARG TMP_DOWNLOAD_DIR="/home/downloads" +ARG WOSS_LIB_BASE="/home/woss" + +# ===== Evinronment variables available in containers too ===== +# Separate directories for uniformity with later versions +ENV NS3_DEBUG_DIR="/home/ns3-debug" +ENV NS3_OPTIMIZED_DIR="/home/ns3-optimized" + +# Variable pointing at ns-3 dedicated Python 3 environment +ENV NS3_PY_ENV="/home/ns3-pyenv" + +# 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 && \ + apt -y install make wget build-essential g++ python3 virtualenv apt-utils && \ + apt -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools && \ + apt -y install gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 && \ + apt -y install autoconf cvs bzr unrar && \ + apt -y install gdb valgrind && \ + apt -y install uncrustify && \ + apt -y install doxygen graphviz imagemagick && \ + apt -y install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng latexmk && \ + apt -y install python3-sphinx dia && \ + apt -y install gsl-bin libgsl-dev libgslcblas0 && \ + apt -y install tcpdump && \ + apt -y install sqlite sqlite3 libsqlite3-dev && \ + apt -y install libxml2 libxml2-dev && \ + apt -y install cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake python3-pip && \ + pip3 install cxxfilt && \ + apt -y install libgtk-3-dev && \ + apt -y install vtun lxc uml-utilities libboost-all-dev && \ + apt -y install gfortran unzip + +# ===== Downloading: ns-3 source, WOSS requirements, and WOSS library ===== +RUN cd /home && mkdir "$TMP_DOWNLOAD_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + wget "https://www.nsnam.org/releases/$NS_ALLINONE.tar.bz2" && \ + tar xjf "$NS_ALLINONE.tar.bz2" && \ + cp -R "$NS_ALLINONE/" ../ && mv ../"$NS_ALLINONE" "$NS3_DEBUG_DIR" && \ + cp -R "$NS_ALLINONE/" ../ && mv ../"$NS_ALLINONE" "$NS3_OPTIMIZED_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; Creating: Python 3 environment for ns-3 ===== +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 && \ + # Python virtual environment for ns-3 + virtualenv --python=/usr/bin/python3 "$NS3_PY_ENV" + +# ===== Building: ns-3 with WOSS; Cleanup: temporary downloads directory ===== +ENV NS3_DEBUG_DIR="$NS3_DEBUG_DIR/$NS_VER" +ENV NS3_OPTIMIZED_DIR="$NS3_OPTIMIZED_DIR/$NS_VER" +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 + echo "" >> ~/.bashrc && \ + echo "# Automatic .bashrc reload and NS3 profile variable" >> ~/.bashrc && \ + echo "trap '. ~/.bashrc' USR1" >> ~/.bashrc && \ + echo 'export NS3_CURR_PROFILE=${NS3_DEBUG_DIR}' >> ~/.bashrc && \ + # Cleanup + rm -rf "$TMP_DOWNLOAD_DIR" && ./build-debug.sh + +CMD ["/bin/bash"] diff --git a/u18.04-n3.33-w1.12.5/at/Makefile b/u18.04-n3.33-w1.12.5/at/Makefile new file mode 100644 index 0000000..3dd8a90 --- /dev/null +++ b/u18.04-n3.33-w1.12.5/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.5/ns3-build/build-debug.sh b/u18.04-n3.33-w1.12.5/ns3-build/build-debug.sh new file mode 100644 index 0000000..9edb2ee --- /dev/null +++ b/u18.04-n3.33-w1.12.5/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="--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.5/ns3-build/build-optimized.sh b/u18.04-n3.33-w1.12.5/ns3-build/build-optimized.sh new file mode 100644 index 0000000..20138a4 --- /dev/null +++ b/u18.04-n3.33-w1.12.5/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.5/ns3-utils/Makefile b/u18.04-n3.33-w1.12.5/ns3-utils/Makefile new file mode 100644 index 0000000..f38a2d0 --- /dev/null +++ b/u18.04-n3.33-w1.12.5/ns3-utils/Makefile @@ -0,0 +1,185 @@ +# 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. + +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: +ifeq ($(SUITE),) + $(error 'gdb_test' target requires a SUITE variable with the ns-3 test suite name) +endif + . $(NS3_PY_ENV)/bin/activate + cd $(NS3_CURR_PROFILE) + ./waf --run test-runner --command-template="gdb %s --suite=$(SUITE)" + deactivate + +.PHONY: clean diff --git a/u18.04-n3.34-w1.12.5/Dockerfile b/u18.04-n3.34-w1.12.5/Dockerfile new file mode 100644 index 0000000..553c148 --- /dev/null +++ b/u18.04-n3.34-w1.12.5/Dockerfile @@ -0,0 +1,144 @@ +# syntax=docker/dockerfile:1 + +# 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. + +FROM ubuntu:18.04 + +LABEL maintainer="giona.emanuele@gmail.com" +LABEL version="0.1" +LABEL description="Ubuntu 18.04 with ns-3.34 and WOSS 1.12.5" + +ARG NS_ALLINONE="ns-allinone-3.34" +ARG NS_VER="ns-3.34" +ARG WOSS_VER="1.12.5" + +ARG TMP_DOWNLOAD_DIR="/home/downloads" +ARG WOSS_LIB_BASE="/home/woss" + +# ===== Evinronment variables available in containers too ===== +# Separate directories for uniformity with later versions +ENV NS3_DEBUG_DIR="/home/ns3-debug" +ENV NS3_OPTIMIZED_DIR="/home/ns3-optimized" + +# Variable pointing at ns-3 dedicated Python 3 environment +ENV NS3_PY_ENV="/home/ns3-pyenv" + +# 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 && \ + apt -y install make wget build-essential g++ python3 virtualenv apt-utils && \ + apt -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools && \ + apt -y install gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 && \ + apt -y install autoconf cvs bzr unrar && \ + apt -y install gdb valgrind && \ + apt -y install uncrustify && \ + apt -y install doxygen graphviz imagemagick && \ + apt -y install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng latexmk && \ + apt -y install python3-sphinx dia && \ + apt -y install gsl-bin libgsl-dev libgslcblas0 && \ + apt -y install tcpdump && \ + apt -y install sqlite sqlite3 libsqlite3-dev && \ + apt -y install libxml2 libxml2-dev && \ + apt -y install cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake python3-pip && \ + pip3 install cxxfilt && \ + apt -y install libgtk-3-dev && \ + apt -y install vtun lxc uml-utilities libboost-all-dev && \ + apt -y install gfortran unzip + +# ===== Downloading: ns-3 source, WOSS requirements, and WOSS library ===== +RUN cd /home && mkdir "$TMP_DOWNLOAD_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + wget "https://www.nsnam.org/releases/$NS_ALLINONE.tar.bz2" && \ + tar xjf "$NS_ALLINONE.tar.bz2" && \ + cp -R "$NS_ALLINONE/" ../ && mv ../"$NS_ALLINONE" "$NS3_DEBUG_DIR" && \ + cp -R "$NS_ALLINONE/" ../ && mv ../"$NS_ALLINONE" "$NS3_OPTIMIZED_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; Creating: Python 3 environment for ns-3 ===== +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 && \ + # Python virtual environment for ns-3 + virtualenv --python=/usr/bin/python3 "$NS3_PY_ENV" + +# ===== Building: ns-3 with WOSS; Cleanup: temporary downloads directory ===== +ENV NS3_DEBUG_DIR="$NS3_DEBUG_DIR/$NS_VER" +ENV NS3_OPTIMIZED_DIR="$NS3_OPTIMIZED_DIR/$NS_VER" +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 + echo "" >> ~/.bashrc && \ + echo "# Automatic .bashrc reload and NS3 profile variable" >> ~/.bashrc && \ + echo "trap '. ~/.bashrc' USR1" >> ~/.bashrc && \ + echo 'export NS3_CURR_PROFILE=${NS3_DEBUG_DIR}' >> ~/.bashrc && \ + # Cleanup + rm -rf "$TMP_DOWNLOAD_DIR" && ./build-debug.sh + +CMD ["/bin/bash"] diff --git a/u18.04-n3.34-w1.12.5/at/Makefile b/u18.04-n3.34-w1.12.5/at/Makefile new file mode 100644 index 0000000..3dd8a90 --- /dev/null +++ b/u18.04-n3.34-w1.12.5/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.5/ns3-build/build-debug.sh b/u18.04-n3.34-w1.12.5/ns3-build/build-debug.sh new file mode 100644 index 0000000..9edb2ee --- /dev/null +++ b/u18.04-n3.34-w1.12.5/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="--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.5/ns3-build/build-optimized.sh b/u18.04-n3.34-w1.12.5/ns3-build/build-optimized.sh new file mode 100644 index 0000000..20138a4 --- /dev/null +++ b/u18.04-n3.34-w1.12.5/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.5/ns3-utils/Makefile b/u18.04-n3.34-w1.12.5/ns3-utils/Makefile new file mode 100644 index 0000000..f38a2d0 --- /dev/null +++ b/u18.04-n3.34-w1.12.5/ns3-utils/Makefile @@ -0,0 +1,185 @@ +# 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. + +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: +ifeq ($(SUITE),) + $(error 'gdb_test' target requires a SUITE variable with the ns-3 test suite name) +endif + . $(NS3_PY_ENV)/bin/activate + cd $(NS3_CURR_PROFILE) + ./waf --run test-runner --command-template="gdb %s --suite=$(SUITE)" + deactivate + +.PHONY: clean diff --git a/u18.04-n3.35-w1.12.5/Dockerfile b/u18.04-n3.35-w1.12.5/Dockerfile new file mode 100644 index 0000000..2a613e0 --- /dev/null +++ b/u18.04-n3.35-w1.12.5/Dockerfile @@ -0,0 +1,144 @@ +# syntax=docker/dockerfile:1 + +# 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. + +FROM ubuntu:18.04 + +LABEL maintainer="giona.emanuele@gmail.com" +LABEL version="0.1" +LABEL description="Ubuntu 18.04 with ns-3.35 and WOSS 1.12.5" + +ARG NS_ALLINONE="ns-allinone-3.35" +ARG NS_VER="ns-3.35" +ARG WOSS_VER="1.12.5" + +ARG TMP_DOWNLOAD_DIR="/home/downloads" +ARG WOSS_LIB_BASE="/home/woss" + +# ===== Evinronment variables available in containers too ===== +# Separate directories for uniformity with later versions +ENV NS3_DEBUG_DIR="/home/ns3-debug" +ENV NS3_OPTIMIZED_DIR="/home/ns3-optimized" + +# Variable pointing at ns-3 dedicated Python 3 environment +ENV NS3_PY_ENV="/home/ns3-pyenv" + +# 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 && \ + apt -y install make wget build-essential g++ python3 virtualenv apt-utils && \ + apt -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools && \ + apt -y install gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 && \ + apt -y install autoconf cvs bzr unrar && \ + apt -y install gdb valgrind && \ + apt -y install uncrustify && \ + apt -y install doxygen graphviz imagemagick && \ + apt -y install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng latexmk && \ + apt -y install python3-sphinx dia && \ + apt -y install gsl-bin libgsl-dev libgslcblas0 && \ + apt -y install tcpdump && \ + apt -y install sqlite sqlite3 libsqlite3-dev && \ + apt -y install libxml2 libxml2-dev && \ + apt -y install cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake python3-pip && \ + pip3 install cxxfilt && \ + apt -y install libgtk-3-dev && \ + apt -y install vtun lxc uml-utilities libboost-all-dev && \ + apt -y install gfortran unzip + +# ===== Downloading: ns-3 source, WOSS requirements, and WOSS library ===== +RUN cd /home && mkdir "$TMP_DOWNLOAD_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + wget "https://www.nsnam.org/releases/$NS_ALLINONE.tar.bz2" && \ + tar xjf "$NS_ALLINONE.tar.bz2" && \ + cp -R "$NS_ALLINONE/" ../ && mv ../"$NS_ALLINONE" "$NS3_DEBUG_DIR" && \ + cp -R "$NS_ALLINONE/" ../ && mv ../"$NS_ALLINONE" "$NS3_OPTIMIZED_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; Creating: Python 3 environment for ns-3 ===== +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 && \ + # Python virtual environment for ns-3 + virtualenv --python=/usr/bin/python3 "$NS3_PY_ENV" + +# ===== Building: ns-3 with WOSS; Cleanup: temporary downloads directory ===== +ENV NS3_DEBUG_DIR="$NS3_DEBUG_DIR/$NS_VER" +ENV NS3_OPTIMIZED_DIR="$NS3_OPTIMIZED_DIR/$NS_VER" +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 + echo "" >> ~/.bashrc && \ + echo "# Automatic .bashrc reload and NS3 profile variable" >> ~/.bashrc && \ + echo "trap '. ~/.bashrc' USR1" >> ~/.bashrc && \ + echo 'export NS3_CURR_PROFILE=${NS3_DEBUG_DIR}' >> ~/.bashrc && \ + # Cleanup + rm -rf "$TMP_DOWNLOAD_DIR" && ./build-debug.sh + +CMD ["/bin/bash"] diff --git a/u18.04-n3.35-w1.12.5/at/Makefile b/u18.04-n3.35-w1.12.5/at/Makefile new file mode 100644 index 0000000..3dd8a90 --- /dev/null +++ b/u18.04-n3.35-w1.12.5/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.5/ns3-build/build-debug.sh b/u18.04-n3.35-w1.12.5/ns3-build/build-debug.sh new file mode 100644 index 0000000..9edb2ee --- /dev/null +++ b/u18.04-n3.35-w1.12.5/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="--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.5/ns3-build/build-optimized.sh b/u18.04-n3.35-w1.12.5/ns3-build/build-optimized.sh new file mode 100644 index 0000000..20138a4 --- /dev/null +++ b/u18.04-n3.35-w1.12.5/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.5/ns3-utils/Makefile b/u18.04-n3.35-w1.12.5/ns3-utils/Makefile new file mode 100644 index 0000000..f38a2d0 --- /dev/null +++ b/u18.04-n3.35-w1.12.5/ns3-utils/Makefile @@ -0,0 +1,185 @@ +# 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. + +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: +ifeq ($(SUITE),) + $(error 'gdb_test' target requires a SUITE variable with the ns-3 test suite name) +endif + . $(NS3_PY_ENV)/bin/activate + cd $(NS3_CURR_PROFILE) + ./waf --run test-runner --command-template="gdb %s --suite=$(SUITE)" + deactivate + +.PHONY: clean diff --git a/u20.04-n3.37-w1.12.5/Dockerfile b/u20.04-n3.37-w1.12.5/Dockerfile new file mode 100644 index 0000000..6ba13c0 --- /dev/null +++ b/u20.04-n3.37-w1.12.5/Dockerfile @@ -0,0 +1,144 @@ +# syntax=docker/dockerfile:1 + +# 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. + +FROM ubuntu:20.04 + +LABEL maintainer="giona.emanuele@gmail.com" +LABEL version="0.1" +LABEL description="Ubuntu 20.04 with ns-3.37 and WOSS 1.12.5" + +ARG NS_ALLINONE="ns-allinone-3.37" +ARG NS_VER="ns-3.37" +ARG WOSS_VER="1.12.5" + +ARG TMP_DOWNLOAD_DIR="/home/downloads" +ARG WOSS_LIB_BASE="/home/woss" + +# ===== Evinronment variables available in containers too ===== +# Separate directories simplify CMake build between profiles +ENV NS3_DEBUG_DIR="/home/ns3-debug" +ENV NS3_OPTIMIZED_DIR="/home/ns3-optimized" + +# Variable pointing at ns-3 dedicated Python 3 environment +ENV NS3_PY_ENV="/home/ns3-pyenv" + +# 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 && \ + apt -y install make wget build-essential g++ python3 virtualenv apt-utils && \ + apt -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools && \ + apt -y install gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 && \ + apt -y install autoconf cvs bzr unrar && \ + apt -y install gdb valgrind && \ + apt -y install uncrustify && \ + apt -y install doxygen graphviz imagemagick && \ + apt -y install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng latexmk && \ + apt -y install python3-sphinx dia && \ + apt -y install gsl-bin libgsl-dev libgslcblas0 && \ + apt -y install tcpdump && \ + apt -y install sqlite sqlite3 libsqlite3-dev && \ + apt -y install libxml2 libxml2-dev && \ + apt -y install cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake python3-pip && \ + pip3 install cxxfilt && \ + apt -y install libgtk-3-dev && \ + apt -y install vtun lxc uml-utilities libboost-all-dev && \ + apt -y install gfortran unzip + +# ===== Downloading: ns-3 source, WOSS requirements, and WOSS library ===== +RUN cd /home && mkdir "$TMP_DOWNLOAD_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + wget "https://www.nsnam.org/releases/$NS_ALLINONE.tar.bz2" && \ + tar xjf "$NS_ALLINONE.tar.bz2" && \ + cp -R "$NS_ALLINONE/" ../ && mv ../"$NS_ALLINONE" "$NS3_DEBUG_DIR" && \ + cp -R "$NS_ALLINONE/" ../ && mv ../"$NS_ALLINONE" "$NS3_OPTIMIZED_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; Creating: Python 3 environment for ns-3 ===== +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 && \ + # Python virtual environment for ns-3 + virtualenv --python=/usr/bin/python3 "$NS3_PY_ENV" + +# ===== Building: ns-3 with WOSS; Cleanup: temporary downloads directory ===== +ENV NS3_DEBUG_DIR="$NS3_DEBUG_DIR/$NS_VER" +ENV NS3_OPTIMIZED_DIR="$NS3_OPTIMIZED_DIR/$NS_VER" +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 + echo "" >> ~/.bashrc && \ + echo "# Automatic .bashrc reload and NS3 profile variable" >> ~/.bashrc && \ + echo "trap '. ~/.bashrc' USR1" >> ~/.bashrc && \ + echo 'export NS3_CURR_PROFILE=${NS3_DEBUG_DIR}' >> ~/.bashrc && \ + # Cleanup + rm -rf "$TMP_DOWNLOAD_DIR" && ./build-debug.sh + +CMD ["/bin/bash"] diff --git a/u20.04-n3.37-w1.12.5/at/Makefile b/u20.04-n3.37-w1.12.5/at/Makefile new file mode 100644 index 0000000..3dd8a90 --- /dev/null +++ b/u20.04-n3.37-w1.12.5/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.37-w1.12.5/ns3-build/build-debug.sh b/u20.04-n3.37-w1.12.5/ns3-build/build-debug.sh new file mode 100644 index 0000000..369988d --- /dev/null +++ b/u20.04-n3.37-w1.12.5/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.37-w1.12.5/ns3-build/build-optimized.sh b/u20.04-n3.37-w1.12.5/ns3-build/build-optimized.sh new file mode 100644 index 0000000..a861661 --- /dev/null +++ b/u20.04-n3.37-w1.12.5/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.37-w1.12.5/ns3-utils/Makefile b/u20.04-n3.37-w1.12.5/ns3-utils/Makefile new file mode 100644 index 0000000..44c863f --- /dev/null +++ b/u20.04-n3.37-w1.12.5/ns3-utils/Makefile @@ -0,0 +1,185 @@ +# 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. + +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: +ifeq ($(SUITE),) + $(error 'gdb_test' target requires a SUITE variable with the ns-3 test suite name) +endif + . $(NS3_PY_ENV)/bin/activate + cd $(NS3_CURR_PROFILE) + ./ns3 run test-runner --command-template="gdb %s --suite=$(SUITE)" + deactivate + +.PHONY: clean diff --git a/u20.04-n3.40-w1.12.5/Dockerfile b/u20.04-n3.40-w1.12.5/Dockerfile new file mode 100644 index 0000000..d4777b2 --- /dev/null +++ b/u20.04-n3.40-w1.12.5/Dockerfile @@ -0,0 +1,144 @@ +# syntax=docker/dockerfile:1 + +# 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. + +FROM ubuntu:20.04 + +LABEL maintainer="giona.emanuele@gmail.com" +LABEL version="0.1" +LABEL description="Ubuntu 20.04 with ns-3.40 and WOSS 1.12.5" + +ARG NS_ALLINONE="ns-allinone-3.40" +ARG NS_VER="ns-3.40" +ARG WOSS_VER="1.12.5" + +ARG TMP_DOWNLOAD_DIR="/home/downloads" +ARG WOSS_LIB_BASE="/home/woss" + +# ===== Evinronment variables available in containers too ===== +# Separate directories simplify CMake build between profiles +ENV NS3_DEBUG_DIR="/home/ns3-debug" +ENV NS3_OPTIMIZED_DIR="/home/ns3-optimized" + +# Variable pointing at ns-3 dedicated Python 3 environment +ENV NS3_PY_ENV="/home/ns3-pyenv" + +# 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 && \ + apt -y install make wget build-essential g++ python3 virtualenv apt-utils && \ + apt -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools && \ + apt -y install gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 && \ + apt -y install autoconf cvs bzr unrar && \ + apt -y install gdb valgrind && \ + apt -y install uncrustify && \ + apt -y install doxygen graphviz imagemagick && \ + apt -y install texlive texlive-extra-utils texlive-latex-extra texlive-font-utils dvipng latexmk && \ + apt -y install python3-sphinx dia && \ + apt -y install gsl-bin libgsl-dev libgslcblas0 && \ + apt -y install tcpdump && \ + apt -y install sqlite sqlite3 libsqlite3-dev && \ + apt -y install libxml2 libxml2-dev && \ + apt -y install cmake libc6-dev libc6-dev-i386 libclang-6.0-dev llvm-6.0-dev automake python3-pip && \ + pip3 install cxxfilt && \ + apt -y install libgtk-3-dev && \ + apt -y install vtun lxc uml-utilities libboost-all-dev && \ + apt -y install gfortran unzip + +# ===== Downloading: ns-3 source, WOSS requirements, and WOSS library ===== +RUN cd /home && mkdir "$TMP_DOWNLOAD_DIR" && cd "$TMP_DOWNLOAD_DIR" && \ + wget "https://www.nsnam.org/releases/$NS_ALLINONE.tar.bz2" && \ + tar xjf "$NS_ALLINONE.tar.bz2" && \ + cp -R "$NS_ALLINONE/" ../ && mv ../"$NS_ALLINONE" "$NS3_DEBUG_DIR" && \ + cp -R "$NS_ALLINONE/" ../ && mv ../"$NS_ALLINONE" "$NS3_OPTIMIZED_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; Creating: Python 3 environment for ns-3 ===== +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 && \ + # Python virtual environment for ns-3 + virtualenv --python=/usr/bin/python3 "$NS3_PY_ENV" + +# ===== Building: ns-3 with WOSS; Cleanup: temporary downloads directory ===== +ENV NS3_DEBUG_DIR="$NS3_DEBUG_DIR/$NS_VER" +ENV NS3_OPTIMIZED_DIR="$NS3_OPTIMIZED_DIR/$NS_VER" +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 + echo "" >> ~/.bashrc && \ + echo "# Automatic .bashrc reload and NS3 profile variable" >> ~/.bashrc && \ + echo "trap '. ~/.bashrc' USR1" >> ~/.bashrc && \ + echo 'export NS3_CURR_PROFILE=${NS3_DEBUG_DIR}' >> ~/.bashrc && \ + # Cleanup + rm -rf "$TMP_DOWNLOAD_DIR" && ./build-debug.sh + +CMD ["/bin/bash"] diff --git a/u20.04-n3.40-w1.12.5/at/Makefile b/u20.04-n3.40-w1.12.5/at/Makefile new file mode 100644 index 0000000..3dd8a90 --- /dev/null +++ b/u20.04-n3.40-w1.12.5/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.5/ns3-build/build-debug.sh b/u20.04-n3.40-w1.12.5/ns3-build/build-debug.sh new file mode 100644 index 0000000..369988d --- /dev/null +++ b/u20.04-n3.40-w1.12.5/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.5/ns3-build/build-optimized.sh b/u20.04-n3.40-w1.12.5/ns3-build/build-optimized.sh new file mode 100644 index 0000000..a861661 --- /dev/null +++ b/u20.04-n3.40-w1.12.5/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.5/ns3-utils/Makefile b/u20.04-n3.40-w1.12.5/ns3-utils/Makefile new file mode 100644 index 0000000..44c863f --- /dev/null +++ b/u20.04-n3.40-w1.12.5/ns3-utils/Makefile @@ -0,0 +1,185 @@ +# 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. + +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: +ifeq ($(SUITE),) + $(error 'gdb_test' target requires a SUITE variable with the ns-3 test suite name) +endif + . $(NS3_PY_ENV)/bin/activate + cd $(NS3_CURR_PROFILE) + ./ns3 run test-runner --command-template="gdb %s --suite=$(SUITE)" + deactivate + +.PHONY: clean