Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change ns3 compilation workflow. Do not need to cp files anymore. #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,13 @@ astra-sim-alibabacloud/build/simai_analytical/build/
test/log/
*.log
.cur*

# for vscode
*.idea

# for clion
cmake-build-*/

# output
results/
bin/
19 changes: 0 additions & 19 deletions astra-sim-alibabacloud/build/astra_ns3/CMakeLists.txt

This file was deleted.

29 changes: 10 additions & 19 deletions astra-sim-alibabacloud/build/astra_ns3/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ echo $SCRIPT_DIR
GEM5_DIR="${SCRIPT_DIR:?}"/../../extern/network_backend/garnet/gem5_astra/
ASTRA_SIM_DIR="${SCRIPT_DIR:?}"/../../astra-sim
INPUT_DIR="${SCRIPT_DIR:?}"/../../inputs
NS3_DIR="${SCRIPT_DIR:?}"/../../extern/network_backend/ns3-interface
NS3_DIR="${SCRIPT_DIR:?}"/../../../ns-3-alibabacloud
NS3_APPLICATION="${NS3_DIR:?}"/simulation/src/applications/
SIM_LOG_DIR=/etc/astra-sim
BUILD_DIR="${SCRIPT_DIR:?}"/build/
Expand All @@ -35,34 +35,26 @@ function cleanup_result {
rm -rf "${RESULT_DIR}"
}

function compile_astrasim {
cd "${BUILD_DIR}" || exit
cmake ..
make
}

function compile {
# Only compile & Run the AstraSimNetwork ns3program
if [ ! -f '"${INPUT_DIR}"/inputs/config/SimAI.conf' ]; then
echo ""${INPUT_DIR}"/config/SimAI.conf is not exist"
cp "${INPUT_DIR}"/config/SimAI.conf "${SIM_LOG_DIR}"/config/SimAI.conf
fi
cp "${ASTRA_SIM_DIR}"/network_frontend/ns3/AstraSimNetwork.cc "${NS3_DIR}"/simulation/scratch/
cp "${ASTRA_SIM_DIR}"/network_frontend/ns3/*.h "${NS3_DIR}"/simulation/scratch/
rm -rf "${NS3_APPLICATION}"/astra-sim
cp -r "${ASTRA_SIM_DIR}" "${NS3_APPLICATION}"/
cd "${NS3_DIR}/simulation"
# CC='gcc-4.9' CXX='g++-4.9'
CC='gcc' CXX='g++'
./ns3 configure -d debug --enable-mtp
./ns3 build

CC='gcc' CXX='g++'
mkdir build
cd build
cmake ..
make -j12 AstraSimNetworkNs3
cd "${SCRIPT_DIR:?}"
}

# this cannot work; should use cmake to debug, neither waf nor ns3
function debug {
cp "${ASTRA_SIM_DIR}"/network_frontend/ns3/AstraSimNetwork.cc "${NS3_DIR}"/simulation/scratch/
cp "${ASTRA_SIM_DIR}"/network_frontend/ns3/*.h "${NS3_DIR}"/simulation/scratch/
# cp "${ASTRA_SIM_DIR}"/network_frontend/ns3/AstraSimNetwork.cc "${NS3_DIR}"/simulation/scratch/
# cp "${ASTRA_SIM_DIR}"/network_frontend/ns3/*.h "${NS3_DIR}"/simulation/scratch/
cd "${NS3_DIR}/simulation"
CC='gcc-4.9' CXX='g++-4.9'
./waf configure
Expand All @@ -82,10 +74,9 @@ case "$1" in
cleanup_result;;
-d|--debug)
setup
debug;;
debug;; # todo: remove?
-c|--compile)
setup
compile_astrasim
compile;;
-r|--run)
setup
Expand Down
10 changes: 5 additions & 5 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SCRIPT_DIR=$(dirname "$(realpath $0)")
ROOT_DIR=$(realpath "${SCRIPT_DIR:?}"/..)
NS3_DIR="${ROOT_DIR:?}"/ns-3-alibabacloud
SIMAI_DIR="${ROOT_DIR:?}"/astra-sim-alibabacloud
SOURCE_NS3_BIN_DIR="${SIMAI_DIR:?}"/extern/network_backend/ns3-interface/simulation/build/scratch/ns3.36.1-AstraSimNetwork-debug
SOURCE_NS3_BIN_DIR="${ROOT_DIR:?}"/ns-3-alibabacloud/simulation/build/AstraSimNetworkNs3
SOURCE_ANA_BIN_DIR="${SIMAI_DIR:?}"/build/simai_analytical/build/simai_analytical/SimAI_analytical
SOURCE_PHY_BIN_DIR="${SIMAI_DIR:?}"/build/simai_phy/build/simai_phynet/SimAI_phynet

Expand All @@ -12,9 +12,9 @@ function compile {
case "$option" in
"ns3")
mkdir -p "${TARGET_BIN_DIR:?}"
rm -rf "${SIMAI_DIR:?}"/extern/network_backend/ns3-interface/
mkdir -p "${SIMAI_DIR:?}"/extern/network_backend/ns3-interface
cp -r "${NS3_DIR:?}"/* "${SIMAI_DIR:?}"/extern/network_backend/ns3-interface
# rm -rf "${SIMAI_DIR:?}"/extern/network_backend/ns3-interface/
# mkdir -p "${SIMAI_DIR:?}"/extern/network_backend/ns3-interface
# cp -r "${NS3_DIR:?}"/* "${SIMAI_DIR:?}"/extern/network_backend/ns3-interface
cd "${SIMAI_DIR:?}"
./build.sh -lr ns3
./build.sh -c ns3
Expand All @@ -40,7 +40,7 @@ function cleanup_build {
case "$option" in
"ns3")
rm "${TARGET_BIN_DIR:?}"/SimAI_simulator
rm -rf "${SIMAI_DIR:?}"/extern/network_backend/ns3-interface/
# rm -rf "${SIMAI_DIR:?}"/extern/network_backend/ns3-interface/
cd "${SIMAI_DIR:?}"
./build.sh -lr ns3;;
"phy")
Expand Down