Skip to content

fix compiler errors for modern linux+clang+python+cuda setup #572

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ CMakeCache.txt
doc
.idea/
apps/tensor_times_vector/tensor_times_vector
*.lock
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
Expand All @@ -7,7 +7,7 @@ if(POLICY CMP0054)
endif()
project(taco
VERSION 0.1
LANGUAGES C CXX
LANGUAGES C CXX CUDA
)
option(CUDA "Build for NVIDIA GPU (CUDA must be preinstalled)" OFF)
option(PYTHON "Build TACO for python environment" OFF)
Expand All @@ -18,7 +18,7 @@ set(TACO_FEATURE_OPENMP 0)
set(TACO_FEATURE_PYTHON 0)
if(CUDA)
message("-- Searching for CUDA Installation")
find_package(CUDA REQUIRED)
find_package(CUDAToolkit)
add_definitions(-DCUDA_BUILT)
set(TACO_FEATURE_CUDA 1)
endif(CUDA)
Expand Down Expand Up @@ -126,13 +126,20 @@ if(GIT_FOUND AND EXISTS "${TACO_PROJECT_DIR}/.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
message(STATUS "Updating submodules with shared lock file: ${CMAKE_SOURCE_DIR}/submodules.lock")
file(LOCK "${CMAKE_SOURCE_DIR}/submodules.lock" TIMEOUT 120)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
execute_process(COMMAND ${GIT_EXECUTABLE} checkout stable
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python_bindings/pybind11
RESULT_VARIABLE GIT_PYBIND11_CHECKOUT_RESULT)
if(NOT GIT_PYBIND11_CHECKOUT_RESULT EQUAL "0")
message(WARNING "git checkout stable failed with ${GIT_SUBMOD_RESULT}, build might be unstable")
endif()
endif()
# get git revision
execute_process(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TL;DR build taco using CMake. Run `make test`.
# Build and test
![Build and Test](https://github.com/RSenApps/taco/workflows/Build%20and%20Test/badge.svg?branch=master)

Build taco using CMake 3.4.0 or greater:
Build taco using CMake 3.18 or greater:

cd <taco-directory>
mkdir build
Expand Down
2 changes: 1 addition & 1 deletion apps/tensor_times_vector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.10)
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
Expand Down
2 changes: 1 addition & 1 deletion python_bindings/pybind11
Submodule pybind11 updated 262 files
5 changes: 3 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)

if (TACO_SHARED_LIBRARY)
set(TACO_LIBRARY_TYPE SHARED)
message("-- Shared library")
Expand All @@ -21,8 +23,7 @@ add_definitions(${TACO_DEFINITIONS})
include_directories(${TACO_SRC_DIR})
add_library(taco ${TACO_LIBRARY_TYPE} ${TACO_HEADERS} ${TACO_SOURCES})
if (CUDA)
include_directories(${CUDA_INCLUDE_DIRS})
target_link_libraries(taco PUBLIC ${CUDA_LIBRARIES})
target_link_libraries(taco PUBLIC CUDA::cudart)
endif (CUDA)
install(TARGETS taco DESTINATION lib)

Expand Down
2 changes: 0 additions & 2 deletions src/lower/lowerer_impl_imperative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ Stmt LowererImplImperative::lowerAssignment(Assignment assignment)
if (isAssembledByUngroupedInsertion(result)) {
std::vector<Expr> coords;
Expr prevPos = 0;
size_t i = 0;
const auto resultIterators = getIterators(assignment.getLhs());
for (const auto& it : resultIterators) {
// TODO: Should only assemble levels that can be assembled together
Expand All @@ -517,7 +516,6 @@ Stmt LowererImplImperative::lowerAssignment(Assignment assignment)
}

prevPos = pos;
++i;
}
}

Expand Down
10 changes: 4 additions & 6 deletions test/tests-scheduling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ TEST(scheduling, multilevel_tiling) {

vector<IndexVar> reordering = {iX1, iX2, iY1, iY2};
sort(reordering.begin(), reordering.end());
int countCorrect = 0;
int countIncorrect = 0;
//int countCorrect = 0;
//int countIncorrect = 0;
do {
// TODO: Precondition (can be broken) bottom most loop must remain unchanged if sparse
bool valid_reordering = reordering[3] == iY2;
Expand All @@ -583,17 +583,15 @@ TEST(scheduling, multilevel_tiling) {
C.compute();
if (!equals(C, expected)) {
//cout << util::join(reordering) << endl;
countIncorrect++;
//countIncorrect++;

std::shared_ptr<ir::CodeGen> codegen = ir::CodeGen::init_default(cout, ir::CodeGen::ImplementationGen);
ir::Stmt compute = lower(reordered, "compute", false, true);
codegen->compile(compute, true);
ASSERT_TENSOR_EQ(expected, C);
exit(1);
}
else {
countCorrect++;
}
//else{countCorrect++;}
} while (next_permutation(reordering.begin(), reordering.end()));
}

Expand Down
2 changes: 1 addition & 1 deletion test/tests-tensor_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TYPED_TEST_P(VectorTensorTest, types) {
ASSERT_EQ(t, a.getComponentType());
ASSERT_EQ(1, a.getOrder());
ASSERT_EQ(5, a.getDimension(0));
map<vector<int>,TypeParam> vals = {{{0}, 1.0}, {{2}, 2.0}};
map<vector<int>,TypeParam> vals = {{{0}, static_cast<TypeParam>(1)}, {{2}, static_cast<TypeParam>(2)}};
for (auto& val : vals) {
a.insert(val.first, val.second);
}
Expand Down