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

[DUCKDB] Do not build PyTorch by default #392

Merged
merged 1 commit into from
Dec 23, 2022
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
5 changes: 3 additions & 2 deletions integration/duckdb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ endif()
#add_compile_options(-mf16c) # opencv

project(lance_duckdb CXX)
option(LANCE_BUILD_PYTORCH "Build with PyTorch" TRUE)
# Build DuckDB PyTorch extension
option(LANCE_BUILD_PYTORCH "Build with PyTorch" OFF)

set(OS_ARCH "amd64")
string(REGEX MATCH "(arm64|aarch64)" IS_ARM "${CMAKE_SYSTEM_PROCESSOR}")
Expand Down Expand Up @@ -35,7 +36,7 @@ FetchContent_Declare(
list(APPEND available_contents duckdb)

if(LANCE_BUILD_PYTORCH)

add_compile_definitions(WITH_PYTORCH)
if(OS_ARCH STREQUAL "amd64")
set(CPU_BASELINE AVX2)
endif()
Expand Down
5 changes: 5 additions & 0 deletions integration/duckdb/src/lance/duckdb/lance-extension.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
#include "lance-extension.h"

#include <duckdb.hpp>
#include <duckdb/parser/parsed_data/create_table_function_info.hpp>

#include "lance/duckdb/lance_reader.h"
#include "lance/duckdb/list_functions.h"
#if defined(WITH_PYTORCH)
#include "lance/duckdb/ml/functions.h"
#endif
#include "lance/duckdb/vector_functions.h"

namespace duckdb {
Expand All @@ -40,13 +43,15 @@ void LanceExtension::Load(::duckdb::DuckDB &db) {
catalog.CreateFunction(context, func.get());
}

#if defined(WITH_PYTORCH)
for (auto &func : lance::duckdb::ml::GetMLFunctions()) {
catalog.CreateFunction(context, func.get());
}

for (auto &func : lance::duckdb::ml::GetMLTableFunctions()) {
catalog.CreateTableFunction(context, func.get());
}
#endif

auto scan_func = lance::duckdb::GetLanceReaderFunction();
::duckdb::CreateTableFunctionInfo scan(scan_func);
Expand Down