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

Remove unused dependencies and fetch gtest via CPM #9332

Merged
merged 4 commits into from
Jun 11, 2024
Merged
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
4 changes: 0 additions & 4 deletions .github/actions/install-metal-deps/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"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",
"libsndfile1=1.0.28-7ubuntu0.2",
"libhwloc-dev",
"graphviz",
"patchelf"
Expand All @@ -15,8 +13,6 @@
"build-essential",
"python3.10-venv",
"libyaml-cpp-dev",
"libboost-all-dev",
"libsndfile1",
"libhwloc-dev",
"graphviz",
"patchelf"
Expand Down
9 changes: 0 additions & 9 deletions .github/actions/install-metal-dev-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 0 additions & 1 deletion .github/actions/install-metal-dev-deps/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"ubuntu-20.04": [
"git",
"git-lfs",
"clang-6.0=1:6.0.1-14",
"pandoc",
"libtbb-dev",
"libcapstone-dev",
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions INSTALLING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
3 changes: 1 addition & 2 deletions dockerfile/ubuntu-20.04-amd64.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
17 changes: 3 additions & 14 deletions scripts/docker/install_test_deps.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
#!/bin/bash

# Check if two arguments are provided
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <gtest_version> <doxygen_version>"
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <doxygen_version>"
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
Expand Down
3 changes: 0 additions & 3 deletions scripts/docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/tt_metal/tt_metal/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions tests/tt_metal/tt_metal/unit_tests_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions tests/ttnn/unit_tests/gtests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading