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

TE with threading build #1092

Merged
merged 9 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 2 additions & 1 deletion build_tools/paddle.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from pathlib import Path

import setuptools
import os

from .utils import cuda_version

Expand Down Expand Up @@ -62,7 +63,7 @@ def setup_paddle_extension(
print("Could not determine CUDA Toolkit version")
else:
if version >= (11, 2):
nvcc_flags.extend(["--threads", "4"])
nvcc_flags.extend(["--threads", os.getenv("NVTE_MAX_BUILD_THREADS", "1")])
if version >= (11, 0):
nvcc_flags.extend(["-gencode", "arch=compute_80,code=sm_80"])
if version >= (11, 8):
Expand Down
2 changes: 1 addition & 1 deletion build_tools/pytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def setup_pytorch_extension(
print("Could not determine CUDA Toolkit version")
else:
if version >= (11, 2):
nvcc_flags.extend(["--threads", "4"])
nvcc_flags.extend(["--threads", os.getenv("NVTE_MAX_BUILD_THREADS", "1")])
if version >= (11, 0):
nvcc_flags.extend(["-gencode", "arch=compute_80,code=sm_80"])
if version >= (11, 8):
Expand Down
15 changes: 15 additions & 0 deletions transformer_engine/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ set(CMAKE_CUDA_STANDARD_REQUIRED ON)

project(transformer_engine LANGUAGES CUDA CXX)

if(NOT DEFINED ENV{NVTE_MAX_BUILD_THREADS})
set(ENV{NVTE_MAX_BUILD_THREADS} "1")
endif()
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --threads $ENV{NVTE_MAX_BUILD_THREADS}")
phu0ngng marked this conversation as resolved.
Show resolved Hide resolved

if(DEFINED ENV{MAX_JOBS})
set(JOBS $ENV{MAX_JOBS})
elseif(DEFINED ENV{NVTE_MAX_BUILD_JOBS})
set(JOBS $ENV{NVTE_MAX_BUILD_JOBS})
else()
set(JOBS "max number of")
endif()

message(STATUS "Parallel build with ${JOBS} jobs and $ENV{NVTE_MAX_BUILD_THREADS} threads per job")

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_CUDA_FLAGS_DEBUG "${CMAKE_CUDA_FLAGS_DEBUG} -G")
endif()
Expand Down
Loading