Skip to content

Commit

Permalink
Moved Kokkos/Kokkos-fft to be primarly handled via DependencyInstaller
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Bylicki <[email protected]>
  • Loading branch information
jbylicki committed Jan 10, 2025
1 parent 96a4551 commit 2dcac77
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 50 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@
[submodule "src/abc"]
path = third-party/abc
url = ../../The-OpenROAD-Project/abc.git
[submodule "src/gpl2/kokkos-fft"]
path = src/gpl2/kokkos-fft
url = https://github.com/kokkos/kokkos-fft.git
103 changes: 71 additions & 32 deletions etc/DependencyInstaller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ _installCommonDev() {
spdlogVersion=1.15.0
gtestVersion=1.13.0
gtestChecksum="a1279c6fb5bf7d4a5e0d0b2a4adb39ac"
kokkosfftVersion="2c616d29a7ad0c390259efeb9224115bfa6910fd"


rm -rf "${baseDir}"
Expand Down Expand Up @@ -153,6 +154,25 @@ _installCommonDev() {
fi
CMAKE_PACKAGE_ROOT_ARGS+=" -D Eigen3_ROOT=$(realpath $eigenPrefix) "

kokkosfftPrefix=${PREFIX:-"/usr/local"}
if [[ ! -d ${kokkosfftPrefix}/include/kokkos ]]; then
cd "${baseDir}"
git clone --recurse-submodules https://github.com/kokkos/kokkos-fft
cd kokkos-fft
git checkout ${kokkosfftVersion}
git submodule update --recursive
ARGS_KOKKOSFFT=" -DCMAKE_BUILD_TYPE=Release -DKokkos_ENABLE_OPENMP=ON -DKokkosFFT_ENABLE_INTERNAL_KOKKOS=ON"
if [[ -n $(which nvcc) ]]; then
# Older version of g++ is needed for compatibility with NVCC
ARGS_KOKKOSFFT+=" -DKokkos_ENABLE_CUDA=ON -DCMAKE_CXX_COMPILER=g++-10"
fi
${cmakePrefix}/bin/cmake -DCMAKE_INSTALL_PREFIX="${kokkosfftPrefix}" ${ARGS_KOKKOSFFT} -B build
${cmakePrefix}/bin/cmake --build build -j $(nproc) --target install
else
echo "KokkosFFT already installed."
fi
CMAKE_PACKAGE_ROOT_ARGS+=" -D Kokkos_ROOT=$(realpath $kokkosfftPrefix) "

# cudd
cuddPrefix=${PREFIX:-"/usr/local"}
if [[ ! -f ${cuddPrefix}/include/cudd.h ]]; then
Expand Down Expand Up @@ -315,7 +335,7 @@ _installUbuntuCleanUp() {
_installUbuntuPackages() {
export DEBIAN_FRONTEND="noninteractive"
apt-get -y update
apt-get -y install --no-install-recommends tzdata
apt-get -y install --no-install-recommends tzdata pciutils
apt-get -y install --no-install-recommends \
automake \
autotools-dev \
Expand All @@ -335,6 +355,8 @@ _installUbuntuPackages() {
libffi-dev \
libgomp1 \
libomp-dev \
libfftw3-dev\
libfmt-dev \
libpcre2-dev \
libpcre3-dev \
libreadline-dev \
Expand All @@ -360,6 +382,10 @@ _installUbuntuPackages() {
packages+=("libpython3.8")
fi

if [[ -n $(lspci -vnnn | grep -i vga.*nvidia*) ]]; then
packages+=("nvidia-cuda-dev" "nvidia-cuda-toolkit" "g++-10")
fi

# Chose QT libraries
if _versionCompare $1 -ge 22.04; then
packages+=(
Expand Down Expand Up @@ -449,36 +475,42 @@ _installOpenSusePackages() {
zypper refresh
zypper -n update
zypper -n install -t pattern devel_basis
zypper -n install \
binutils \
clang \
gcc \
gcc11-c++ \
git \
groff \
gzip \
lcov \
libffi-devel \
libgomp1 \
libomp11-devel \
libpython3_6m1_0 \
libqt5-creator \
libqt5-qtbase \
libqt5-qtstyleplugins \
libstdc++6-devel-gcc8 \
llvm \
pandoc \
pcre-devel \
pcre2-devel \
python3-devel \
python3-pip \
qimgv \
readline-devel \
tcl \
tcl-devel \
tcllib \
wget \
zlib-devel
zypper -n --gpg-auto-import-keys \
--plus-repo https://download.opensuse.org/repositories/games/$(grep ^VERSION= /etc/os-release | sed 's/VERSION="\(.*\)"/\1/g') \
--plus-repo https://download.opensuse.org/repositories/Education/$(grep ^VERSION= /etc/os-release | sed 's/VERSION="\(.*\)"/\1/g')\
install \
binutils \
clang \
fftw3-devel\
gcc \
gcc11-c++ \
git \
groff \
gzip \
lcov \
libffi-devel \
libgomp1 \
libomp11-devel \
libfmt11 \
libpython3_6m1_0 \
libqt5-creator \
libqt5-qtbase \
libqt5-qtstyleplugins \
libstdc++6-devel-gcc8 \
llvm \
pandoc \
pcre-devel \
pcre2-devel \
python3-devel \
python3-pip \
qimgv \
readline-devel \
tcl \
tcl-devel \
tcllib \
unzip \
wget \
zlib-devel

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 50
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 50
Expand Down Expand Up @@ -542,7 +574,7 @@ _installDebianCleanUp() {
_installDebianPackages() {
export DEBIAN_FRONTEND="noninteractive"
apt-get -y update
apt-get -y install --no-install-recommends tzdata
apt-get -y install --no-install-recommends tzdata pciutils
if [[ $1 == rodete ]]; then
tclver=8.6
else
Expand All @@ -565,6 +597,8 @@ _installDebianPackages() {
lcov \
libffi-dev \
libgomp1 \
libfftw3-dev\
libfmt-dev \
libomp-dev \
libpcre2-dev \
libpcre3-dev \
Expand All @@ -580,6 +614,11 @@ _installDebianPackages() {
wget \
zlib1g-dev

if [[ -n $(lspci -vnnn | grep -i vga.*nvidia*) ]]; then
apt-get -y install --no-install-recommends nvidia-cuda-dev nvidia-cuda-toolkit g++-10
fi


if [[ $1 == 10 ]]; then
apt-get install -y --no-install-recommends \
libpython3.7 \
Expand Down
34 changes: 22 additions & 12 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,19 +271,30 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)

if(USE_GPL2)
find_package(OpenMP REQUIRED)
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "Set Kokkos OpenMP backend" FORCE)
if(GPU)
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "Set Kokkos CUDA backend" FORCE)
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "Enable Kokkos CUDA Lambda support" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_NO_CUDA")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14")
message(FATAL_ERROR "Detected version of GCC is not supported by NVCC. Consider using Clang or disabling GPU support.")
find_package(Kokkos)
find_package(KokkosFFT)
if(NOT (${Kokkos_FOUND} AND ${KokkosFFT_FOUND}))
include(FetchContent)
FetchContent_Populate(
kokkos-fft
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gpl2/kokkos-fft
GIT_REPOSITORY https://github.com/kokkos/kokkos-fft
GIT_TAG origin/main
)
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "Set Kokkos OpenMP backend" FORCE)
if(GPU)
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "Set Kokkos CUDA backend" FORCE)
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "Enable Kokkos CUDA Lambda support" FORCE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_NO_CUDA")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "14")
message(FATAL_ERROR "Detected version of GCC is not supported by NVCC. Consider using Clang or disabling GPU support.")
endif()
else()
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "Set Kokkos CUDA backend" FORCE)
set(Kokkos_ENABLE_CUDA_LAMBDA OFF CACHE BOOL "Enable Kokkos CUDA Lambda support" FORCE)
endif()
else()
set(Kokkos_ENABLE_CUDA OFF CACHE BOOL "Set Kokkos CUDA backend" FORCE)
set(Kokkos_ENABLE_CUDA_LAMBDA OFF CACHE BOOL "Enable Kokkos CUDA Lambda support" FORCE)
set(KokkosFFT_ENABLE_INTERNAL_KOKKOS ON CACHE BOOL "Use Kokkos-FFT to build Kokkos" FORCE)
endif()
set(KokkosFFT_ENABLE_INTERNAL_KOKKOS ON CACHE BOOL "Use Kokkos-FFT to build Kokkos" FORCE)
else()
add_compile_options(
-Wp,-D_GLIBCXX_ASSERTIONS
Expand Down Expand Up @@ -408,7 +419,6 @@ if(USE_GPL2)
target_link_libraries(openroad
gpl2
KokkosFFT::fft
omp
fmt::fmt-header-only
)
endif()
Expand Down
5 changes: 3 additions & 2 deletions src/gpl2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ find_package(Eigen3 REQUIRED)
find_package(OpenMP REQUIRED)
find_package(fmt REQUIRED)

add_subdirectory(kokkos-fft)
if(NOT (${Kokkos_FOUND} AND ${KokkosFFT_FOUND}))
add_subdirectory(kokkos-fft)
endif()

swig_lib(NAME gpl2
NAMESPACE gpl2
Expand Down Expand Up @@ -78,7 +80,6 @@ target_link_libraries(gpl2
OpenSTA
rsz
grt
omp
KokkosFFT::fft
fmt::fmt-header-only
)
Expand Down
1 change: 0 additions & 1 deletion src/gpl2/kokkos-fft
Submodule kokkos-fft deleted from 2c616d

0 comments on commit 2dcac77

Please sign in to comment.