Compare commits
4 Commits
update-cud
...
fix-format
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
136fcc7ba1 | ||
|
|
60182d8959 | ||
|
|
bfe752433f | ||
|
|
8fe8314905 |
@@ -7,4 +7,5 @@ repos:
|
||||
rev: v0.6.13
|
||||
hooks:
|
||||
- id: cmake-format
|
||||
- id: cmake-lint
|
||||
- id: cmake-lint
|
||||
args: [--disabled-codes=C0301]
|
||||
|
||||
@@ -8,5 +8,16 @@ if(NOT pybind11_FOUND)
|
||||
FetchContent_MakeAvailable(pybind11)
|
||||
endif()
|
||||
|
||||
# Needed to set ${Python_VERSION_MAJOR} and ${Python_VERSION_MINOR}
|
||||
find_package(Python REQUIRED)
|
||||
|
||||
pybind11_add_module(pytrigdx bindings.cpp)
|
||||
target_link_libraries(pytrigdx PRIVATE trigdx)
|
||||
set_target_properties(pytrigdx PROPERTIES OUTPUT_NAME "trigdx")
|
||||
|
||||
set(PYTHON_SITE_PACKAGES
|
||||
"${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages/trigdx"
|
||||
)
|
||||
|
||||
install(TARGETS pytrigdx DESTINATION ${PYTHON_SITE_PACKAGES})
|
||||
install(FILES __init__.py DESTINATION ${PYTHON_SITE_PACKAGES})
|
||||
|
||||
16
python/__init__.py
Normal file
16
python/__init__.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from .trigdx import Reference, Lookup16K, Lookup32K, LookupAVX16K, LookupAVX32K
|
||||
|
||||
try:
|
||||
from .trigdx import MKL
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
from .trigdx import GPU
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
from .trigdx import LookupXSIMD16K, LookupXSIMD32K
|
||||
except ImportError:
|
||||
pass
|
||||
@@ -72,7 +72,9 @@ void bind_backend(py::module &m, const char *name) {
|
||||
.def("compute_sincosf", &compute_sincos<float>);
|
||||
}
|
||||
|
||||
PYBIND11_MODULE(pytrigdx, m) {
|
||||
PYBIND11_MODULE(trigdx, m) {
|
||||
m.doc() = "TrigDx python bindings";
|
||||
|
||||
py::class_<Backend, std::shared_ptr<Backend>>(m, "Backend")
|
||||
.def("init", &Backend::init);
|
||||
|
||||
@@ -91,4 +93,4 @@ PYBIND11_MODULE(pytrigdx, m) {
|
||||
bind_backend<LookupXSIMDBackend<16384>>(m, "LookupXSIMD16K");
|
||||
bind_backend<LookupXSIMDBackend<32768>>(m, "LookupXSIMD32K");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user