From 039c4078cea3cb22a4864790d3a68a8a9c6ab85d Mon Sep 17 00:00:00 2001 From: Bill Teng Date: Sat, 8 Jun 2024 08:10:42 +0000 Subject: [PATCH 1/4] #9332: remove boost, clang, and sndfile dependencies --- .github/actions/install-metal-deps/dependencies.json | 3 --- .github/actions/install-metal-dev-deps/dependencies.json | 1 - 2 files changed, 4 deletions(-) diff --git a/.github/actions/install-metal-deps/dependencies.json b/.github/actions/install-metal-deps/dependencies.json index 3778d296c22..c6240bd5c0f 100644 --- a/.github/actions/install-metal-deps/dependencies.json +++ b/.github/actions/install-metal-deps/dependencies.json @@ -5,7 +5,6 @@ "python3.8-venv=3.8.10-0ubuntu1~20.04.9", "libgoogle-glog-dev=0.4.0-1build1", "libyaml-cpp-dev=0.6.2-4ubuntu1", - "libsndfile1=1.0.28-7ubuntu0.2", "libhwloc-dev", "graphviz", "patchelf" @@ -15,8 +14,6 @@ "build-essential", "python3.10-venv", "libyaml-cpp-dev", - "libboost-all-dev", - "libsndfile1", "libhwloc-dev", "graphviz", "patchelf" diff --git a/.github/actions/install-metal-dev-deps/dependencies.json b/.github/actions/install-metal-dev-deps/dependencies.json index a0a2d7d5807..1d1ca55c93b 100644 --- a/.github/actions/install-metal-dev-deps/dependencies.json +++ b/.github/actions/install-metal-dev-deps/dependencies.json @@ -3,7 +3,6 @@ "ubuntu-20.04": [ "git", "git-lfs", - "clang-6.0=1:6.0.1-14", "pandoc", "libtbb-dev", "libcapstone-dev", From f94d849df896aa5af27f8e330df980909d327ccf Mon Sep 17 00:00:00 2001 From: Bill Teng Date: Sat, 8 Jun 2024 08:25:55 +0000 Subject: [PATCH 2/4] #9332: remove glog --- .github/actions/install-metal-deps/dependencies.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/install-metal-deps/dependencies.json b/.github/actions/install-metal-deps/dependencies.json index c6240bd5c0f..17175fe9745 100644 --- a/.github/actions/install-metal-deps/dependencies.json +++ b/.github/actions/install-metal-deps/dependencies.json @@ -3,7 +3,6 @@ "software-properties-common=0.99.9.12", "build-essential=12.8ubuntu1.1", "python3.8-venv=3.8.10-0ubuntu1~20.04.9", - "libgoogle-glog-dev=0.4.0-1build1", "libyaml-cpp-dev=0.6.2-4ubuntu1", "libhwloc-dev", "graphviz", From 766fbb68ea518fc6171d08fbfb9004d5e68a033c Mon Sep 17 00:00:00 2001 From: Bill Teng Date: Sat, 8 Jun 2024 08:26:26 +0000 Subject: [PATCH 3/4] #9332: remove boost, glog, and libsndfile1 from install instructions --- INSTALLING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALLING.md b/INSTALLING.md index de903635fd9..1224ad9a773 100644 --- a/INSTALLING.md +++ b/INSTALLING.md @@ -26,7 +26,7 @@ Note the current compatability matrix: ```sh sudo apt update -sudo apt install software-properties-common=0.99.9.12 build-essential=12.8ubuntu1.1 python3.8-venv=3.8.10-0ubuntu1~20.04.9 libgoogle-glog-dev=0.4.0-1build1 libyaml-cpp-dev=0.6.2-4ubuntu1 libboost-all-dev=1.71.0.0ubuntu2 libsndfile1=1.0.28-7ubuntu0.2 libhwloc-dev graphviz +sudo apt install software-properties-common=0.99.9.12 build-essential=12.8ubuntu1.1 python3.8-venv=3.8.10-0ubuntu1~20.04.9 libyaml-cpp-dev=0.6.2-4ubuntu1 libhwloc-dev graphviz # Install Clang-17 for C++20 support!! wget https://apt.llvm.org/llvm.sh From aa876e0cb0dcaba6b9764ab54cc5f7b6254a6579 Mon Sep 17 00:00:00 2001 From: Bill Teng Date: Sat, 8 Jun 2024 09:20:57 +0000 Subject: [PATCH 4/4] #9332: fetch gtest via CPM --- .../actions/install-metal-dev-deps/action.yml | 9 --------- CMakeLists.txt | 10 +++++++++- INSTALLING.md | 2 -- dockerfile/ubuntu-20.04-amd64.Dockerfile | 3 +-- scripts/docker/install_test_deps.sh | 17 +++-------------- scripts/docker/requirements.txt | 3 --- tests/CMakeLists.txt | 4 +++- .../tt_metal/tt_metal/unit_tests/CMakeLists.txt | 1 + .../tt_metal/unit_tests_common/CMakeLists.txt | 1 + .../unit_tests_fast_dispatch/CMakeLists.txt | 1 + .../CMakeLists.txt | 1 + .../tt_metal/unit_tests_frequent/CMakeLists.txt | 1 + tests/ttnn/unit_tests/gtests/CMakeLists.txt | 1 + 13 files changed, 22 insertions(+), 32 deletions(-) diff --git a/.github/actions/install-metal-dev-deps/action.yml b/.github/actions/install-metal-dev-deps/action.yml index 704507d3434..dcf1588a201 100644 --- a/.github/actions/install-metal-dev-deps/action.yml +++ b/.github/actions/install-metal-dev-deps/action.yml @@ -37,15 +37,6 @@ runs: tar -xvf doxygen-1.9.6.linux.bin.tar.gz cd doxygen-1.9.6 sudo make install - - name: Install gtest - shell: bash - run: | - curl -L "https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz" -o v1.13.0.tar.gz - tar -xvf v1.13.0.tar.gz - cd googletest-1.13.0 - cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON . - make - sudo make install - name: Install Clang-17 shell: bash run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 6fcf321aed1..f54ab3c0766 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,13 +33,21 @@ CHECK_COMPILERS() # Find all required libraries to build ############################################################################################################################ include(${PROJECT_SOURCE_DIR}/cmake/CPM_boost.cmake) -find_package(GTest REQUIRED) find_package (Python3 COMPONENTS Interpreter Development) find_library(NUMA_LIBRARY NAMES numa) if (NOT NUMA_LIBRARY) message(FATAL_ERROR "NUMA library not found") endif() +CPMAddPackage( + NAME googletest + GITHUB_REPOSITORY google/googletest + GIT_TAG release-1.12.1 + VERSION 1.12.1 + OPTIONS "INSTALL_GTEST OFF" +) + + ############################################################################################################################ # Setting build type flags # Will default to assert build, unless CONFIG env variable is set or manually set -DCMAKE_BUILD_TYPE diff --git a/INSTALLING.md b/INSTALLING.md index 1224ad9a773..7cd0ac78c95 100644 --- a/INSTALLING.md +++ b/INSTALLING.md @@ -128,5 +128,3 @@ sudo apt install git git-lfs cmake=3.16.3-1ubuntu1.20.04.1 pandoc libtbb-dev lib ``` 2. Download and install [Doxygen](https://www.doxygen.nl/download.html), (v1.9 or higher, but less than v1.10) - -3. Download and install [gtest](https://github.com/google/googletest) from source (v1.13) diff --git a/dockerfile/ubuntu-20.04-amd64.Dockerfile b/dockerfile/ubuntu-20.04-amd64.Dockerfile index a5ca82f1d76..e1d05e18ca8 100644 --- a/dockerfile/ubuntu-20.04-amd64.Dockerfile +++ b/dockerfile/ubuntu-20.04-amd64.Dockerfile @@ -2,7 +2,6 @@ FROM ubuntu:20.04 ARG DEBIAN_FRONTEND=noninteractive -ENV GTEST_VERSION=1.13.0 ENV DOXYGEN_VERSION=1.9.6 # Install build and runtime deps @@ -19,7 +18,7 @@ RUN apt-get -y update \ ## Test Related Dependencies COPY /scripts/docker/install_test_deps.sh /opt/tt_metal_infra/scripts/docker/install_test_deps.sh -RUN /bin/bash /opt/tt_metal_infra/scripts/docker/install_test_deps.sh ${GTEST_VERSION} ${DOXYGEN_VERSION} +RUN /bin/bash /opt/tt_metal_infra/scripts/docker/install_test_deps.sh ${DOXYGEN_VERSION} # Copy remaining convenience scripts COPY /scripts /opt/tt_metal_infra/scripts diff --git a/scripts/docker/install_test_deps.sh b/scripts/docker/install_test_deps.sh index 2f6c3fedde2..88face8c94f 100755 --- a/scripts/docker/install_test_deps.sh +++ b/scripts/docker/install_test_deps.sh @@ -1,23 +1,12 @@ #!/bin/bash # Check if two arguments are provided -if [ "$#" -ne 2 ]; then - echo "Usage: $0 " +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " exit 1 fi -GTEST_VERSION=$1 -DOXYGEN_VERSION=$2 - -# Installs Google test -mkdir -p /opt/tt_metal_infra/googletest -chmod ugo+w /opt/tt_metal_infra/googletest -wget -O /opt/tt_metal_infra/googletest/googletest-release-${GTEST_VERSION}.tar.gz https://github.com/google/googletest/archive/refs/tags/v${GTEST_VERSION}.tar.gz -tar -xzf /opt/tt_metal_infra/googletest/googletest-release-${GTEST_VERSION}.tar.gz -C /opt/tt_metal_infra/googletest/ -cd /opt/tt_metal_infra/googletest/googletest-${GTEST_VERSION} -cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON . -make -make install +DOXYGEN_VERSION=$1 # Install doxygen mkdir -p /opt/tt_metal_infra/doxygen diff --git a/scripts/docker/requirements.txt b/scripts/docker/requirements.txt index 1b8609142cd..0f5bc89a57f 100644 --- a/scripts/docker/requirements.txt +++ b/scripts/docker/requirements.txt @@ -2,12 +2,9 @@ apt-utils dialog software-properties-common=0.99.9.12 build-essential=12.8ubuntu1.1 -libgoogle-glog-dev=0.4.0-1build1 libyaml-cpp-dev=0.6.2-4ubuntu1 git git-lfs -libboost-all-dev=1.71.0.0ubuntu2 -libsndfile1=1.0.28-7ubuntu0.2 pandoc libtbb-dev libcapstone-dev diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4d7ed51a461..603ba16a917 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,6 +1,8 @@ +enable_testing() +include(GoogleTest) add_library(test_common_libs INTERFACE) -target_link_libraries(test_common_libs INTERFACE pthread stdc++fs GTest::GTest GTest::Main) +target_link_libraries(test_common_libs INTERFACE pthread stdc++fs gtest gtest_main) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tt_metal/tt_metal) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tt_eager) diff --git a/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt index e1fadfaafec..b46d91c320b 100644 --- a/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt @@ -43,5 +43,6 @@ target_include_directories(unit_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common ${CMAKE_CURRENT_SOURCE_DIR}/circular_buffer + ${gtest_SOURCE_DIR}/include ) set_target_properties(unit_tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/test/tt_metal) diff --git a/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt index 924ce4cba38..2a954cbd57a 100644 --- a/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt @@ -36,4 +36,5 @@ target_include_directories(unit_tests_common_o PUBLIC ${PROJECT_SOURCE_DIR}/tt_metal/common ${PROJECT_SOURCE_DIR}/tests ${CMAKE_CURRENT_SOURCE_DIR}/common + ${gtest_SOURCE_DIR}/include ) diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt index df860f41e16..5377b471696 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch/CMakeLists.txt @@ -23,5 +23,6 @@ target_include_directories(unit_tests_fast_dispatch PRIVATE ${PROJECT_SOURCE_DIR}/tests ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common + ${gtest_SOURCE_DIR}/include ) set_target_properties(unit_tests_fast_dispatch PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/test/tt_metal) diff --git a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt index 3b3578ba3c6..4ed39a15588 100644 --- a/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests_fast_dispatch_single_chip_multi_queue/CMakeLists.txt @@ -15,5 +15,6 @@ target_include_directories(unit_tests_fast_dispatch_single_chip_multi_queue PRIV ${PROJECT_SOURCE_DIR}/tests ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common + ${gtest_SOURCE_DIR}/include ) set_target_properties(unit_tests_fast_dispatch_single_chip_multi_queue PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/test/tt_metal) diff --git a/tests/tt_metal/tt_metal/unit_tests_frequent/CMakeLists.txt b/tests/tt_metal/tt_metal/unit_tests_frequent/CMakeLists.txt index 636cddd0558..589f2df86dd 100644 --- a/tests/tt_metal/tt_metal/unit_tests_frequent/CMakeLists.txt +++ b/tests/tt_metal/tt_metal/unit_tests_frequent/CMakeLists.txt @@ -13,5 +13,6 @@ target_include_directories(unit_tests_frequent PRIVATE ${PROJECT_SOURCE_DIR}/tests ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/common + ${gtest_SOURCE_DIR}/include ) set_target_properties(unit_tests_frequent PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/test/tt_metal) diff --git a/tests/ttnn/unit_tests/gtests/CMakeLists.txt b/tests/ttnn/unit_tests/gtests/CMakeLists.txt index 2c1f825ab68..05af1e23e00 100644 --- a/tests/ttnn/unit_tests/gtests/CMakeLists.txt +++ b/tests/ttnn/unit_tests/gtests/CMakeLists.txt @@ -15,5 +15,6 @@ target_include_directories(unit_tests_ttnn PRIVATE ${PROJECT_SOURCE_DIR}/tt_metal ${PROJECT_SOURCE_DIR}/tests ${CMAKE_CURRENT_SOURCE_DIR} + ${gtest_SOURCE_DIR}/include ) set_target_properties(unit_tests_ttnn PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/test/ttnn)