Skip to content

Commit 2829f04

Browse files
committed
Clean up some unnecessary things from scipy#99
1 parent eed6bf4 commit 2829f04

7 files changed

Lines changed: 18 additions & 1353 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,8 @@ project(xsf)
66
set(CMAKE_CXX_STANDARD 17)
77
set(CMAKE_CXX_STANDARD_REQUIRED ON)
88

9-
# Help find packages in conda/pixi environment
10-
if(DEFINED ENV{CONDA_PREFIX})
11-
message(STATUS "Using conda prefix: $ENV{CONDA_PREFIX}")
12-
list(APPEND CMAKE_PREFIX_PATH "$ENV{CONDA_PREFIX}")
13-
set(ENV{PKG_CONFIG_PATH} "$ENV{CONDA_PREFIX}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
14-
endif()
15-
16-
#============================================
17-
# SDB says: Use pkg-config to find blas & lapack
18-
# which are requred to run the Mathieu tests.
19-
# Find pkg-config
20-
find_package(PkgConfig REQUIRED)
21-
22-
# Use pkg-config to find a library
23-
#pkg_check_modules(BLAS REQUIRED blas)
24-
#pkg_check_modules(LAPACK REQUIRED lapack)
25-
26-
#pkg_search_module(BLAS IMPORTED_TARGET REQUIRED openblas blas)
27-
#pkg_search_module(LAPACK IMPORTED_TARGET REQUIRED openblas lapack)
28-
29-
#============================================
30-
319
# Tests
32-
# Turned on by SDB
33-
option(BUILD_TESTS "Build the tests" ON)
10+
option(BUILD_TESTS "Build the tests" OFF)
3411

3512
if(BUILD_TESTS)
3613
enable_testing()

include/xsf/numpy.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -803,9 +803,11 @@ namespace numpy {
803803

804804
Func func = static_cast<ufunc_data<Func> *>(data)->func;
805805
for (npy_intp i = 0; i < dims[0]; ++i) {
806-
Res res = func(npy_traits<Args>::get(
807-
args[I], new_dims.data() + ranks_scan[I], steps + ranks_scan[I] + sizeof...(Args) + 1
808-
)...);
806+
Res res = func(
807+
npy_traits<Args>::get(
808+
args[I], new_dims.data() + ranks_scan[I], steps + ranks_scan[I] + sizeof...(Args) + 1
809+
)...
810+
);
809811
npy_traits<Res>::set(args[sizeof...(Args)], res); // assign to the output pointer
810812

811813
for (npy_uintp j = 0; j <= sizeof...(Args); ++j) {
@@ -837,9 +839,11 @@ namespace numpy {
837839

838840
Func func = static_cast<ufunc_data<Func> *>(data)->func;
839841
for (npy_intp i = 0; i < dims[0]; ++i) {
840-
func(npy_traits<Args>::get(
841-
args[I], new_dims.data() + ranks_scan[I], steps + ranks_scan[I] + sizeof...(Args)
842-
)...);
842+
func(
843+
npy_traits<Args>::get(
844+
args[I], new_dims.data() + ranks_scan[I], steps + ranks_scan[I] + sizeof...(Args)
845+
)...
846+
);
843847

844848
for (npy_uintp j = 0; j < sizeof...(Args); ++j) {
845849
args[j] += steps[j];

meson.build

Lines changed: 2 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -4,126 +4,7 @@ project(
44
version : '0.2.2',
55
license : 'BSD-3-Clause AND MIT AND BSD-3-Clause-LBNL AND Apache-2.0 WITH LLVM-exception',
66
license_files : ['LICENSE', 'LICENSES_bundled.txt'],
7-
meson_version : '>=1.5.0',
8-
default_options : ['cpp_std=c++17']
7+
meson_version : '>=1.5.0'
98
)
109

11-
# Get compiler
12-
cpp = meson.get_compiler('cpp')
13-
14-
# ========================================
15-
# BLAS/LAPACK Dependencies -- needed for Mathieu fcns.
16-
# ========================================
17-
blas_name = get_option('blas')
18-
lapack_name = get_option('lapack')
19-
20-
if blas_name == ''
21-
# Auto-detect BLAS
22-
blas = dependency('blas', required: false)
23-
if not blas.found()
24-
blas = cpp.find_library('blas', required: false)
25-
endif
26-
if not blas.found()
27-
blas = dependency('openblas', required: false)
28-
endif
29-
if not blas.found()
30-
blas = cpp.find_library('openblas', required: true)
31-
endif
32-
else
33-
# Use specified BLAS
34-
blas = dependency(blas_name, required: true)
35-
endif
36-
37-
if lapack_name == ''
38-
# Auto-detect LAPACK
39-
lapack = dependency('lapack', required: false)
40-
if not lapack.found()
41-
lapack = cpp.find_library('lapack', required: false)
42-
endif
43-
if not lapack.found()
44-
lapack = dependency('openblas', required: false)
45-
endif
46-
if not lapack.found()
47-
lapack = cpp.find_library('openblas', required: true)
48-
endif
49-
else
50-
# Use specified LAPACK
51-
lapack = dependency(lapack_name, required: true)
52-
endif
53-
54-
message('xsf: BLAS library: ' + blas.type_name())
55-
message('xsf: LAPACK library: ' + lapack.type_name())
56-
57-
# Combined dependency
58-
blas_lapack_dep = declare_dependency(
59-
dependencies: [blas, lapack]
60-
)
61-
62-
# ========================================
63-
# Float128 Configuration
64-
# ========================================
65-
66-
# Check for _Float128 support
67-
float128_code = '''
68-
int main() {
69-
_Float128 x = 1.0;
70-
return 0;
71-
}
72-
'''
73-
74-
has_float128 = cpp.compiles(float128_code, name: '_Float128 support')
75-
76-
# Configuration data
77-
conf_data = configuration_data()
78-
conf_data.set('HAVE_FLOAT128', has_float128)
79-
configure_file(
80-
output: 'xsf_config.h',
81-
configuration: conf_data
82-
)
83-
84-
# ========================================
85-
# Includes
86-
# ========================================
87-
xsf_inc = include_directories('include')
88-
89-
90-
# ========================================
91-
# Declare Dependency
92-
# ========================================
93-
94-
xsf_dep = declare_dependency(
95-
include_directories: xsf_inc,
96-
dependencies: blas_lapack_dep,
97-
)
98-
99-
# Make it discoverable
100-
meson.override_dependency('xsf', xsf_dep)
101-
102-
# ========================================
103-
# Installation
104-
# ========================================
105-
106-
if not meson.is_subproject()
107-
# Install headers
108-
install_headers(
109-
'include/xsf/mathieu/mathieu_fcns.h',
110-
subdir: 'xsf/mathieu'
111-
)
112-
113-
# Install pkg-config file
114-
pkg = import('pkgconfig')
115-
pkg.generate(
116-
xsf_lib,
117-
name: 'xsf',
118-
description: 'XSF Special Functions Library',
119-
version: meson.project_version(),
120-
)
121-
endif
122-
123-
# ========================================
124-
# Tests (optional)
125-
# ========================================
126-
127-
if get_option('build_tests')
128-
subdir('tests')
129-
endif
10+
xsf_dep = declare_dependency(include_directories : 'include')

meson_options.txt

Lines changed: 0 additions & 7 deletions
This file was deleted.

pixi.toml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ version = "0.2.2"
1515
cmake = ">=3.30.5,<4"
1616
cxx-compiler = ">=1.8.0,<2"
1717
make = ">=4.4.1,<5"
18-
openblas = "*"
19-
pkg-config = "*"
20-
2118

2219
[feature.build.tasks.configure]
2320
cmd = [
@@ -26,7 +23,6 @@ cmd = [
2623
"-S .",
2724
# We want to build in the build directory
2825
"-B build",
29-
"-DCMAKE_PREFIX_PATH=$CONDA_PREFIX",
3026
]
3127
cwd = "."
3228

@@ -216,8 +212,4 @@ test-cupy.depends-on = ["install-xsref-test-cupy"]
216212
default = { features = ["build", "tests", "tests-debug"], solve-group = "default" }
217213
tests-ci = { features = ["build", "tests", "tests-ci", "tests-debug", "tests-debug-ci", "coverage"], solve-group = "default"}
218214
lint = { features = ["clang-format"], solve-group = "default" }
219-
cupy-tests = { features = ["cupy-tests"], solve-group = "cupy" }
220-
221-
[dependencies]
222-
pkg-config = ">=0.29.2,<0.30"
223-
openblas = ">=0.3.30,<0.4"
215+
cupy-tests = { features = ["cupy-tests"], solve-group = "default" }

tests/CMakeLists.txt

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@ find_package(Catch2 3 REQUIRED)
33
find_package(Arrow REQUIRED)
44
find_package(Parquet REQUIRED)
55

6-
#============================================
7-
# SDB says: Use pkg-config to find blas & lapack
8-
# which are requred to run the Mathieu tests.
9-
# Find pkg-config
10-
find_package(PkgConfig REQUIRED)
11-
12-
# Use pkg-config to find a library
13-
pkg_search_module(BLAS REQUIRED IMPORTED_TARGET openblas blas)
14-
pkg_search_module(LAPACK REQUIRED IMPORTED_TARGET openblas lapack)
15-
#============================================
166

177
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
188
# Enable debug assertions to make sure they won't get triggered in debug builds of
@@ -30,14 +20,10 @@ add_library(xsf INTERFACE)
3020
target_include_directories(xsf INTERFACE ${CMAKE_SOURCE_DIR}/include)
3121

3222
set(TEST_BASE_DIR "${CMAKE_SOURCE_DIR}/tests")
33-
include(${CMAKE_SOURCE_DIR}/tests/Coverage.cmake)
3423

35-
# Include CTest once at the top level
36-
include(CTest)
37-
enable_testing()
24+
include(${CMAKE_SOURCE_DIR}/tests/Coverage.cmake)
3825

3926
file(GLOB TEST_SOURCES "*/test_*.cpp")
40-
4127
foreach(test_file ${TEST_SOURCES})
4228
# Families of tests go in subfolders of xsf/tests. Test files in different
4329
# folders can have the same name. Try to generate a unique target name based
@@ -50,34 +36,10 @@ foreach(test_file ${TEST_SOURCES})
5036

5137
add_executable(${target_name} ${test_file})
5238

53-
#===========================================
54-
# SDB added blas and lapack to link libs
55-
target_link_libraries(${target_name} PRIVATE
56-
Catch2::Catch2WithMain
57-
Arrow::arrow_shared
58-
Parquet::parquet_shared
59-
PkgConfig::BLAS
60-
PkgConfig::LAPACK
61-
xsf)
39+
target_link_libraries(${target_name} PRIVATE Catch2::Catch2WithMain Arrow::arrow_shared Parquet::parquet_shared xsf)
6240

6341
target_compile_definitions(${target_name} PRIVATE XSREF_TABLES_PATH="${XSREF_TABLES_PATH}")
6442
include(CTest)
65-
66-
target_compile_definitions(${target_name} PRIVATE
67-
XSREF_TABLES_PATH="${XSREF_TABLES_PATH}"
68-
)
69-
70-
# Manual test registration instead of catch_discover_tests
71-
add_test(
72-
NAME ${target_name}
73-
COMMAND ${target_name}
74-
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
75-
)
76-
77-
# Set test properties
78-
set_tests_properties(${target_name} PROPERTIES
79-
TIMEOUT 300
80-
ENVIRONMENT "XSREF_TABLES_PATH=${XSREF_TABLES_PATH}"
81-
)
82-
43+
include(Catch)
44+
catch_discover_tests(${target_name})
8345
endforeach()

0 commit comments

Comments
 (0)