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

@@ -7,5 +7,4 @@ repos:
rev: v0.6.13
hooks:
- id: cmake-format
- id: cmake-lint
args: [--disabled-codes=C0301]
- id: cmake-lint

View File

@@ -8,16 +8,5 @@ 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})

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>);
}
PYBIND11_MODULE(trigdx, m) {
m.doc() = "TrigDx python bindings";
PYBIND11_MODULE(pytrigdx, m) {
py::class_<Backend, std::shared_ptr<Backend>>(m, "Backend")
.def("init", &Backend::init);
@@ -93,4 +91,4 @@ PYBIND11_MODULE(trigdx, m) {
bind_backend<LookupXSIMDBackend<16384>>(m, "LookupXSIMD16K");
bind_backend<LookupXSIMDBackend<32768>>(m, "LookupXSIMD32K");
#endif
}
}