Skip to content

Commit

Permalink
v0.2.1 (#116)
Browse files Browse the repository at this point in the history
* Fix a header installation bug
* Check the Python version during build
* Resolve compilation warnings
  • Loading branch information
chhwang authored Sep 7, 2023
1 parent 693fe01 commit 335da67
Show file tree
Hide file tree
Showing 28 changed files with 54 additions and 80 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cff-version: 1.2.0
title: "ARK: A GPU-driven system framework for scalable AI applications"
version: 0.2.0
version: 0.2.1
message: >-
If you use this project in your research, please cite it as below.
authors:
Expand Down
59 changes: 15 additions & 44 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

set(ARK_MAJOR "0")
set(ARK_MINOR "2")
set(ARK_PATCH "0")
set(ARK_PATCH "1")

set(ARK_VERSION "${ARK_MAJOR}.${ARK_MINOR}.${ARK_PATCH}")
set(ARK_SOVERSION "${ARK_MAJOR}.${ARK_MINOR}")
Expand Down Expand Up @@ -45,11 +45,11 @@ if(CUDAToolkit_FOUND)
endif()

if(CUDAToolkit_VERSION_MAJOR GREATER_EQUAL 11)
set(CMAKE_CUDA_ARCHITECTURES 70 80)
set(CMAKE_CUDA_ARCHITECTURES 60 70 80)
endif()

if(CUDAToolkit_VERSION_MAJOR GREATER_EQUAL 12)
set(CMAKE_CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES} 70 80 90)
set(CMAKE_CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES} 90)
endif()
endif()

Expand Down Expand Up @@ -100,50 +100,21 @@ add_custom_target(ut)
# Details
add_subdirectory(ark)

# Add header files to library targets
file(GLOB_RECURSE ARK_HEADERS CONFIGURE_DEPENDS
${CMAKE_SOURCE_DIR}/ark/include/*.h)
file(GLOB_RECURSE CUTLASS_HEADERS CONFIGURE_DEPENDS
${CMAKE_SOURCE_DIR}/third_party/cutlass/include/*.h
${CMAKE_SOURCE_DIR}/third_party/cutlass/include/*.hpp
${CMAKE_SOURCE_DIR}/third_party/cutlass/include/*.inl)
target_sources(ark PUBLIC
FILE_SET install_headers
TYPE HEADERS
BASE_DIRS ${CMAKE_SOURCE_DIR}/ark/include
FILES ${ARK_HEADERS}
)
target_sources(ark_static PUBLIC
FILE_SET install_headers
TYPE HEADERS
BASE_DIRS ${CMAKE_SOURCE_DIR}/ark/include
FILES ${ARK_HEADERS}
)
target_sources(ark PUBLIC
FILE_SET install_cutlass_headers
TYPE HEADERS
BASE_DIRS ${CMAKE_SOURCE_DIR}/third_party/cutlass/include
FILES ${CUTLASS_HEADERS}
)
target_sources(ark_static PUBLIC
FILE_SET install_cutlass_headers
TYPE HEADERS
BASE_DIRS ${CMAKE_SOURCE_DIR}/third_party/cutlass/include
FILES ${CUTLASS_HEADERS}
)

# Install libraries
install(TARGETS ark ark_static
LIBRARY DESTINATION ark/lib
ARCHIVE DESTINATION ark/lib
FILE_SET install_headers DESTINATION ark/include
FILE_SET install_cutlass_headers DESTINATION ark/include/kernels
)

# Install Python module
if(BUILD_PYTHON)
# Install Python module
add_subdirectory(python)
add_dependencies(ark_py build)
install(TARGETS ark_py LIBRARY DESTINATION ark)
else()
# Install libraries
install(TARGETS ark ark_static
LIBRARY DESTINATION ark/lib
ARCHIVE DESTINATION ark/lib
)
endif()

# Install header files
install(DIRECTORY ${BUILD_DIR}/include DESTINATION ark)

# Utils
include(${PROJECT_SOURCE_DIR}/cmake/Utils.cmake)
2 changes: 1 addition & 1 deletion ark/include/ark.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#define ARK_MAJOR 0
#define ARK_MINOR 2
#define ARK_PATCH 0
#define ARK_PATCH 1
#define ARK_VERSION (ARK_MAJOR * 10000 + ARK_MINOR * 100 + ARK_PATCH)

namespace ark {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_add.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Tensor *Model::add(Tensor *input, Tensor *other, Tensor *output,
{
CHECK(input != nullptr);
CHECK(other != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_div.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Tensor *Model::div(Tensor *input, Tensor *other, Tensor *output,
{
assert(input != nullptr);
assert(other != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_exp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ std::string ExpOp::function_name(const OpConfig &cfg) const
Tensor *Model::exp(Tensor *input, Tensor *output, const string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_gelu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ std::string GeluOp::function_name(const OpConfig &cfg) const
Tensor *Model::gelu(Tensor *input, Tensor *output, const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
4 changes: 2 additions & 2 deletions ark/ops/ops_im2col.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Tensor *Model::im2col(Tensor *input, int kernel_height, int kernel_width,
Tensor *output, const std::string &name)
{
assert(input != nullptr);
DimType n, c, h, w;
DimType n = 1, c = 1, h = 1, w = 1;
int input_ndims = input->ndims();
if (input_ndims == 2) {
n = 1;
Expand All @@ -107,7 +107,7 @@ Tensor *Model::im2col(Tensor *input, int kernel_height, int kernel_width,
"invalid # of input dimensions. Expected 2, 3, or 4, but given ",
input_ndims);
}
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_layernorm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ std::string LayernormOp::function_name(const OpConfig &cfg) const
Tensor *Model::layernorm(Tensor *input, Tensor *output, const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_matmul.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Tensor *Model::matmul(Tensor *mat_a, Tensor *mat_b, Tensor *mat_y,
LOG(ERROR, "inner dimensions mismatch: ", k, " and ", k2);
}

OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (mat_a->type == FP16) {
pt = OP_PREC_FP16;
} else if (mat_a->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_max_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Tensor *Model::max_pool(Tensor *input, DimType kernel_size, DimType stride,
Tensor *output, const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_mul.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Tensor *Model::mul(Tensor *input, Tensor *other, Tensor *output,
{
assert(input != nullptr);
assert(other != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
6 changes: 3 additions & 3 deletions ark/ops/ops_reduce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Tensor *Model::reduce_sum(Tensor *input, int axis, Tensor *output,
const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down Expand Up @@ -174,7 +174,7 @@ Tensor *Model::reduce_mean(Tensor *input, int axis, Tensor *output,
const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down Expand Up @@ -208,7 +208,7 @@ Tensor *Model::reduce_max(Tensor *input, int axis, Tensor *output,
const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_relu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ std::string ReluOp::function_name(const OpConfig &cfg) const
Tensor *Model::relu(Tensor *input, Tensor *output, const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_rmsnorm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ std::string RMSnormOp::function_name(const OpConfig &cfg) const
Tensor *Model::rmsnorm(Tensor *input, Tensor *output, const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_rope.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Tensor *Model::rope(Tensor *input, Tensor *other, Tensor *output,
{
assert(input != nullptr);
assert(other != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 0 additions & 2 deletions ark/ops/ops_rope_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ void baseline_rope(std::vector<void *> &outputs, const std::vector<ark::Dims> &,
T *other = static_cast<T *>(inputs[1]);

ark::Dims ish = input_shapes[0].dims4();
ark::Dims other_sh = input_shapes[1].dims4();
assert(ish == other_sh);

for (ark::DimType n = 0; n < ish[0]; ++n) {
for (ark::DimType c = 0; c < ish[1]; ++c) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_scale.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Tensor *Model::scale(Tensor *input, float val, Tensor *output,
const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_sigmoid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ std::string SigmoidOp::function_name(const OpConfig &cfg) const
Tensor *Model::sigmoid(Tensor *input, Tensor *output, const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_softmax.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ std::string SoftmaxOp::function_name(const OpConfig &cfg) const
Tensor *Model::softmax(Tensor *input, Tensor *output, const std::string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_sqrt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ std::string SqrtOp::function_name(const OpConfig &cfg) const
Tensor *Model::sqrt(Tensor *input, Tensor *output, const string &name)
{
assert(input != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_sub.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Tensor *Model::sub(Tensor *input, Tensor *other, Tensor *output,
{
assert(input != nullptr);
assert(other != nullptr);
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/ops/ops_transpose.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ std::string TransposeOp::function_name(const OpConfig &cfg) const
Tensor *Model::transpose(Tensor *input, Dims perm, Tensor *output,
const std::string &name)
{
OpPrecType pt;
OpPrecType pt = OP_PREC_NONE;
if (input->type == FP16) {
pt = OP_PREC_FP16;
} else if (input->type == FP32) {
Expand Down
2 changes: 1 addition & 1 deletion ark/sched/sched.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const OpConfig *BaseScheduler::sched_op_config(const Op *op)
return nullptr;
}
const GpuInfo &gpu_info = this->gpu_mgr->get_gpu_info();
OpArchType arch_type;
OpArchType arch_type = OP_ARCH_CUDA_60;
if (gpu_info.arch == GPU_ARCH_CUDA_60) {
arch_type = OP_ARCH_CUDA_60;
} else if (gpu_info.arch == GPU_ARCH_CUDA_70) {
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
project = "ARK"
copyright = "2023, ARK Team"
author = "ARK Team"
version = "0.2.0"
release = "0.2.0"
version = "0.2.1"
release = "0.2.1"

# -- General configuration ---------------------------------------------------

Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ build-backend = "scikit_build_core.build"

[project]
name = "ark"
version = "0.2.0"
version = "0.2.1"

[tool.scikit-build]
cmake.minimum-version = "3.25"
cmake.args = []
cmake.verbose = false
cmake.build-type = "Release"
cmake.targets = ["ark_py"]
wheel.packages = ["python/ark"]
wheel.license-files = ["LICENSE", "CITATION.cff", "CODE_OF_CONDUCT.md", "SECURITY.md", "SUPPORT.md"]
install.strip = true
build-dir = "build/{wheel_tag}"

[tool.scikit-build.cmake.define]
Expand Down
12 changes: 7 additions & 5 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

find_package(Python3 COMPONENTS Interpreter Development.Module REQUIRED)
find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
if(Python3_FOUND)
if(${Python3_VERSION} VERSION_LESS 3.8)
message(FATAL_ERROR "Python version must be at least 3.8")
endif()
endif()

include(FetchContent)
FetchContent_Declare(
pybind11
Expand All @@ -13,7 +19,3 @@ FetchContent_MakeAvailable(pybind11)
pybind11_add_module(ark_py ${CMAKE_CURRENT_SOURCE_DIR}/bindings.cpp)
set_target_properties(ark_py PROPERTIES OUTPUT_NAME _ark_core)
target_link_libraries(ark_py PRIVATE ark_static)

if (SKBUILD)
install(TARGETS ark_py LIBRARY DESTINATION ark)
endif()
2 changes: 1 addition & 1 deletion third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ add_custom_target(tp-update

# Patch CUTLASS
add_custom_target(tp-cutlass
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/cutlass && patch -sN -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patches/cutlass/cutlass.patch | true
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR}/cutlass && patch -sN -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patches/cutlass/cutlass.patch || true
)
add_dependencies(tp-cutlass tp-update)

Expand Down

0 comments on commit 335da67

Please sign in to comment.