Skip to content

Commit 47c5759

Browse files
fabinschjcarpent
authored andcommitted
arm: do not use instruction set
1 parent e047643 commit 47c5759

File tree

3 files changed

+39
-26
lines changed

3 files changed

+39
-26
lines changed

bindings/python/CMakeLists.txt

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,27 @@ file(GLOB_RECURSE PYWRAP_HEADERS ${CMAKE_CURRENT_LIST_DIR}/src/*.hpp)
1919

2020
file(GLOB_RECURSE PYWRAP_SOURCES ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp)
2121

22-
# Add simd feature detectors for current CPU
23-
python3_add_library(instructionset MODULE helpers/instruction-set.cpp)
24-
add_dependencies(python instructionset)
25-
target_link_libraries(instructionset PRIVATE proxsuite pybind11::module)
26-
set_target_properties(
27-
instructionset
28-
PROPERTIES OUTPUT_NAME instructionset
29-
LIBRARY_OUTPUT_DIRECTORY
30-
"${CMAKE_BINARY_DIR}/bindings/python/${PROJECT_NAME}")
31-
if(UNIX AND NOT APPLE)
32-
set_target_properties(instructionset PROPERTIES INSTALL_RPATH
33-
"\$ORIGIN/../../..")
22+
# Add simd feature detectors for current intel CPU
23+
message("-- CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
24+
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "AMD64" OR ${CMAKE_SYSTEM_PROCESSOR}
25+
MATCHES "x86_64")
26+
python3_add_library(instructionset MODULE helpers/instruction-set.cpp)
27+
add_dependencies(python instructionset)
28+
target_link_libraries(instructionset PRIVATE proxsuite pybind11::module)
29+
set_target_properties(
30+
instructionset
31+
PROPERTIES OUTPUT_NAME instructionset
32+
LIBRARY_OUTPUT_DIRECTORY
33+
"${CMAKE_BINARY_DIR}/bindings/python/${PROJECT_NAME}")
34+
if(UNIX AND NOT APPLE)
35+
set_target_properties(instructionset PROPERTIES INSTALL_RPATH
36+
"\$ORIGIN/../../..")
37+
endif()
38+
install(
39+
TARGETS instructionset
40+
EXPORT ${TARGETS_EXPORT_NAME}
41+
DESTINATION ${${PYWRAP}_INSTALL_DIR})
3442
endif()
35-
install(
36-
TARGETS instructionset
37-
EXPORT ${TARGETS_EXPORT_NAME}
38-
DESTINATION ${${PYWRAP}_INSTALL_DIR})
39-
4043
function(CREATE_PYTHON_TARGET target_name COMPILE_OPTIONS dependencies)
4144
python3_add_library(${target_name} MODULE ${PYWRAP_SOURCES} ${PYWRAP_HEADERS})
4245
add_dependencies(python ${target_name})
@@ -46,7 +49,6 @@ function(CREATE_PYTHON_TARGET target_name COMPILE_OPTIONS dependencies)
4649
target_link_libraries(${target_name} PRIVATE proxsuite pybind11::module)
4750
target_compile_definitions(${target_name}
4851
PRIVATE PYTHON_MODULE_NAME=${target_name})
49-
5052
set_target_properties(
5153
${target_name}
5254
PROPERTIES OUTPUT_NAME ${target_name}
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
from . import instructionset
1+
import platform
2+
3+
if (
4+
"i386" in platform.processor()
5+
or "x86_64" in platform.processor()
6+
or "Intel64" in platform.processor()
7+
):
8+
from . import instructionset
29

310

411
def load_main_module(globals):
@@ -13,17 +20,19 @@ def load_module(main_module_name):
1320
except ModuleNotFoundError:
1421
return False
1522

16-
all_modules = [
17-
("proxsuite_pywrap_avx512", instructionset.has_AVX512F),
18-
("proxsuite_pywrap_avx2", instructionset.has_AVX2),
19-
]
23+
if "arm" not in platform.processor():
24+
all_modules = [
25+
("proxsuite_pywrap_avx512", instructionset.has_AVX512F),
26+
("proxsuite_pywrap_avx2", instructionset.has_AVX2),
27+
]
2028

21-
for module_name, checker in all_modules:
22-
if checker() and load_module(module_name):
23-
return
29+
for module_name, checker in all_modules:
30+
if checker() and load_module(module_name):
31+
return
2432

2533
assert load_module("proxsuite_pywrap") == True
2634

2735

2836
load_main_module(globals=globals())
2937
del load_main_module
38+
del platform

include/proxsuite/linalg/dense/core.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
#include <proxsuite/linalg/veg/util/assert.hpp>
1010
#include <proxsuite/linalg/veg/memory/dynamic_stack.hpp>
1111

12+
#ifndef __aarch64__
1213
#include <immintrin.h>
14+
#endif
1315

1416
#ifdef PROXSUITE_VECTORIZE
1517
#include <cmath> // to avoid error of the type no member named 'isnan' in namespace 'std';

0 commit comments

Comments
 (0)