Skip to content

Commit

Permalink
Revert "don't disable blas SYR on non-amd64 platforms by default"
Browse files Browse the repository at this point in the history
This reverts commit 7e97117.
  • Loading branch information
david-cortes committed Apr 18, 2023
1 parent 7e97117 commit e033490
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
17 changes: 3 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.12.4)
project (cmfrec VERSION 3.5.2)
project (cmfrec VERSION 3.5.1)
set(CMAKE_BUILD_TYPE Release)

### Note: this build script allows configuring 4 things manually:
Expand Down Expand Up @@ -366,18 +366,11 @@ endif()
list(APPEND union_list ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES})
list(REMOVE_DUPLICATES union_list)

# https://stackoverflow.com/questions/26657082/detect-x86-architecture-in-cmake-file
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)")
set (IS_AMD64 TRUE)
else ()
set (IS_AMD64 FALSE)
endif ()

# See https://github.com/xianyi/OpenBLAS/issues/3237
set(CMAKE_REQUIRED_LINK_OPTIONS ${union_list})
set(CMAKE_REQUIRED_LIBRARIES ${union_list})
CHECK_LIBRARY_EXISTS("" "openblas_get_num_threads" "" HAS_OPENBLAS)
if (HAS_OPENBLAS AND IS_AMD64)
if (HAS_OPENBLAS)
message(STATUS "Using OpenBLAS - will replace its SYR function.")
add_compile_definitions(AVOID_BLAS_SYR)
add_compile_definitions(HAS_OPENBLAS)
Expand All @@ -387,15 +380,11 @@ else()
add_compile_definitions(HAS_MKL)
else()
CHECK_LIBRARY_EXISTS("" "catlas_saxpby" "" HAS_ATLAS)
if (HAS_ATLAS AND IS_AMD64)
if (HAS_ATLAS)
message(STATUS "Using ATLAS - will replace its SYR function.")
message(WARNING "Note: ATLAS multi-threading might make this library very slow.")
add_compile_definitions(HAS_ATLAS)
add_compile_definitions(AVOID_BLAS_SYR)
else()
if (HAS_ATLAS)
message(WARNING "Note: ATLAS multi-threading might make this library very slow.")
endif()
endif()
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: cmfrec
Type: Package
Title: Collective Matrix Factorization for Recommender Systems
Version: 3.5.2
Version: 3.5.1-1
Authors@R: c(
person(given="David", family="Cortes", role=c("aut", "cre", "cph"),
email="[email protected]"),
Expand Down
10 changes: 4 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
from Cython.Distutils import build_ext
import sys, os, subprocess, warnings, re
import platform


found_omp = True
def set_omp_false():
Expand Down Expand Up @@ -45,8 +45,6 @@ def set_omp_false():
except AttributeError:
EXIT_SUCCESS = 0

is_amd64 = platform.machine() in ("i386", "AMD64", "x86_64")

class build_ext_subclass( build_ext_with_blas ):
def build_extensions(self):
is_windows = sys.platform[:3].lower() == "win"
Expand Down Expand Up @@ -350,7 +348,7 @@ def test_supports_clang_reassociate(self):
setup(
name = "cmfrec",
packages = ["cmfrec"],
version = '3.5.2',
version = '3.5.1-4',
description = 'Collective matrix factorization',
author = 'David Cortes',
url = 'https://github.com/david-cortes/cmfrec',
Expand All @@ -375,7 +373,7 @@ def test_supports_clang_reassociate(self):
("USE_DOUBLE", None),
("NDEBUG", None),
("USE_FINDBLAS" if use_findblas else "NO_FINDBLAS", None),
("USE_BLAS_SYR" if (use_findblas or not is_amd64) else "AVOID_BLAS_SYR", None)]
("USE_BLAS_SYR" if use_findblas else "AVOID_BLAS_SYR", None)]
),
Extension("cmfrec.wrapper_float",
sources=["cmfrec/cfuns_float.pyx" if use_findblas else "cmfrec/cfuns_float_plusblas.pyx",
Expand All @@ -387,7 +385,7 @@ def test_supports_clang_reassociate(self):
("USE_FLOAT", None),
("NDEBUG", None),
("USE_FINDBLAS" if use_findblas else "NO_FINDBLAS", None),
("USE_BLAS_SYR" if (use_findblas or not is_amd64) else "AVOID_BLAS_SYR", None)]
("USE_BLAS_SYR" if use_findblas else "AVOID_BLAS_SYR", None)]
),
]
)
Expand Down
2 changes: 1 addition & 1 deletion src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ real_t fun_grad_cannonical_form
*******************************************************************************/
#if defined(AVOID_BLAS_SYR) && !(defined(FOR_R) && !defined(__SSE__))
#ifdef AVOID_BLAS_SYR
#undef cblas_tsyr
#define cblas_tsyr(order, Uplo, N, alpha, X, incX, A, lda) \
custom_syr(N, alpha, X, A, lda)
Expand Down

0 comments on commit e033490

Please sign in to comment.