6 Commits

Author SHA1 Message Date
Bram Veenboer
2a10cad3dd Fix compilation errors 2025-09-02 16:59:19 +02:00
Bram Veenboer
2c2a59d6d6 Apply formatting 2025-09-02 16:26:59 +02:00
Bram Veenboer
a1f2dd6c4d Apply suggestions from code review
Co-authored-by: Wiebe van Breukelen <breukelen@astron.nl>
2025-09-02 16:26:27 +02:00
Bram Veenboer
3dcca92b79 Remove remaining init and std::memcpy 2025-09-02 13:19:50 +02:00
Bram Veenboer
8df4bbf54e Add allocate_memory and free_memory 2025-09-02 12:03:31 +02:00
Bram Veenboer
716f323b26 Update GPU memory management
- Move device memory allocation for output out of init
- Copy directly from device memory to host pointers
2025-09-02 09:33:36 +02:00
4 changed files with 3 additions and 33 deletions

View File

@@ -8,4 +8,3 @@ repos:
hooks: hooks:
- id: cmake-format - id: cmake-format
- id: cmake-lint - id: cmake-lint
args: [--disabled-codes=C0301]

View File

@@ -8,16 +8,5 @@ if(NOT pybind11_FOUND)
FetchContent_MakeAvailable(pybind11) FetchContent_MakeAvailable(pybind11)
endif() endif()
# Needed to set ${Python_VERSION_MAJOR} and ${Python_VERSION_MINOR}
find_package(Python REQUIRED)
pybind11_add_module(pytrigdx bindings.cpp) pybind11_add_module(pytrigdx bindings.cpp)
target_link_libraries(pytrigdx PRIVATE trigdx) 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})

View File

@@ -1,16 +0,0 @@
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

View File

@@ -72,9 +72,7 @@ void bind_backend(py::module &m, const char *name) {
.def("compute_sincosf", &compute_sincos<float>); .def("compute_sincosf", &compute_sincos<float>);
} }
PYBIND11_MODULE(trigdx, m) { PYBIND11_MODULE(pytrigdx, m) {
m.doc() = "TrigDx python bindings";
py::class_<Backend, std::shared_ptr<Backend>>(m, "Backend") py::class_<Backend, std::shared_ptr<Backend>>(m, "Backend")
.def("init", &Backend::init); .def("init", &Backend::init);