summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFJ-NaokiMatsumura <98728917+FJ-NaokiMatsumura@users.noreply.github.com>2022-03-28 10:22:18 +0900
committerGitHub <noreply@github.com>2022-03-27 19:22:18 -0600
commit26f94b24e80cd4f84a3cd02b413292fde82a359d (patch)
tree9098fe76c6521e40d74b956f31ba316e3c8f68c1
parentc75fb4da20b8e22da6cebec5ab6e8758bfe8ce23 (diff)
downloadspack-26f94b24e80cd4f84a3cd02b413292fde82a359d.tar.gz
spack-26f94b24e80cd4f84a3cd02b413292fde82a359d.tar.bz2
spack-26f94b24e80cd4f84a3cd02b413292fde82a359d.tar.xz
spack-26f94b24e80cd4f84a3cd02b413292fde82a359d.zip
py-torch: fix to build with fujitsu-ssl2 (#29283)
* py-torch: fix build with fujitsu-ssl2 * fix to use fujitsu-ssl2 in py-torch v1.5.0 to v1.11.0 * fix to use fujitsu-ssl2 in py-torch v1.2.0 to v1.11.0 * Delete fj-ssl2.patch * renamed the patches * Rename fj-ssl2.1.5.patch to fj-ssl2_1.5.patch * Delete fj-ssl2_1.5.patch
-rw-r--r--var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.10.patch76
-rw-r--r--var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.11.patch76
-rw-r--r--var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.2.patch76
-rw-r--r--var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.3-1.5.patch76
-rw-r--r--var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.6-1.7.patch76
-rw-r--r--var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.8.patch76
-rw-r--r--var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.9.patch76
-rw-r--r--var/spack/repos/builtin/packages/py-torch/package.py12
8 files changed, 544 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.10.patch b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.10.patch
new file mode 100644
index 0000000000..bcd2c37804
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.10.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index ca560288a4..f5a29ecf43 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -130,7 +130,7 @@ else()
+ set(AT_MKLDNN_ENABLED 0)
+ set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;vecLib")
++set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;SSL2;vecLib")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+
+ if(BLAS STREQUAL "Eigen")
+@@ -185,6 +185,20 @@ elseif(BLAS STREQUAL "vecLib")
+ set(BLAS_INFO "veclib")
+ set(BLAS_FOUND 1)
+ set(BLAS_LIBRARIES ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ message(STATUS "SSL2 Selected BLAS library")
++ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++ set(SSL2_FOUND ON)
++ message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ set(WITH_BLAS "ssl2")
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
+ elseif(BLAS STREQUAL "Generic")
+ # On Debian family, the CBLAS ABIs have been merged into libblas.so
+ find_library(BLAS_LIBRARIES blas)
+@@ -201,7 +215,7 @@ if(NOT INTERN_BUILD_MOBILE)
+ set(AT_MKL_ENABLED 0)
+ set(AT_MKL_MT 0)
+ set(USE_BLAS 1)
+- if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND))
++ if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR SSL2_FOUND OR VECLIB_FOUND))
+ message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+ find_package(BLAS)
+ if(NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index 47c80b45f6..efd4a87d06 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -276,6 +276,28 @@ if((NOT BLAS_LIBRARIES)
+ endif()
+ endif()
+
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ check_fortran_libraries(
++ BLAS_LIBRARIES
++ BLAS
++ sgemm
++ "-SSL2;--linkfortran"
++ "fjlapackexsve")
++ if (BLAS_LIBRARIES)
++ set(BLAS_INFO "ssl2")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ endif (BLAS_LIBRARIES)
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.11.patch b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.11.patch
new file mode 100644
index 0000000000..af41e5bb93
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.11.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 557ab649a4..56d1699736 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -174,7 +174,7 @@ else()
+ set(AT_MKLDNN_ENABLED 0)
+ set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;vecLib")
++set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;SSL2;vecLib")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+
+ if(BLAS STREQUAL "Eigen")
+@@ -229,6 +229,20 @@ elseif(BLAS STREQUAL "vecLib")
+ set(BLAS_INFO "veclib")
+ set(BLAS_FOUND 1)
+ set(BLAS_LIBRARIES ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ message(STATUS "SSL2 Selected BLAS library")
++ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++ set(SSL2_FOUND ON)
++ message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ set(WITH_BLAS "ssl2")
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
+ elseif(BLAS STREQUAL "FlexiBLAS")
+ find_package(FlexiBLAS REQUIRED)
+ include_directories(SYSTEM ${FlexiBLAS_INCLUDE_DIR})
+@@ -250,7 +264,7 @@ if(NOT INTERN_BUILD_MOBILE)
+ set(AT_MKL_SEQUENTIAL 0)
+ set(AT_MKL_MT 0)
+ set(USE_BLAS 1)
+- if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND OR FlexiBLAS_FOUND))
++ if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR SSL2_FOUND OR VECLIB_FOUND OR FlexiBLAS_FOUND))
+ message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+ find_package(BLAS)
+ if(NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index 94942d520f..ae5b8db963 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -289,6 +289,28 @@ if((NOT BLAS_LIBRARIES)
+ endif()
+ endif()
+
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ check_fortran_libraries(
++ BLAS_LIBRARIES
++ BLAS
++ sgemm
++ "-SSL2;--linkfortran"
++ "fjlapackexsve")
++ if (BLAS_LIBRARIES)
++ set(BLAS_INFO "ssl2")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ endif (BLAS_LIBRARIES)
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.2.patch b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.2.patch
new file mode 100644
index 0000000000..826c5c2b07
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.2.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 00dcabd131..bddd3716ca 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -107,7 +107,7 @@ else()
+ set(AT_MKLDNN_ENABLED 0)
+ set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib")
++set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+
+ if(BLAS STREQUAL "Eigen")
+@@ -147,6 +147,20 @@ elseif(BLAS STREQUAL "vecLib")
+ find_package(vecLib REQUIRED)
+ include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
+ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ message(STATUS "SSL2 Selected BLAS library")
++ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++ set(SSL2_FOUND ON)
++ message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ set(WITH_BLAS "ssl2")
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
+ else()
+ message(FATAL_ERROR "Unrecognized BLAS option: " ${BLAS})
+ endif()
+@@ -156,7 +170,7 @@ if (NOT INTERN_BUILD_MOBILE)
+ set(AT_MKL_ENABLED 0)
+ set(AT_MKL_MT 0)
+ set(USE_BLAS 1)
+- if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND))
++ if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND))
+ message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+ find_package(BLAS)
+ if (NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index d6c0346739..72f4e18da2 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -225,6 +225,28 @@ if((NOT BLAS_LIBRARIES)
+ endif (BLAS_LIBRARIES)
+ endif()
+
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ check_fortran_libraries(
++ BLAS_LIBRARIES
++ BLAS
++ sgemm
++ "-SSL2;--linkfortran"
++ "fjlapackexsve")
++ if (BLAS_LIBRARIES)
++ set(BLAS_INFO "ssl2")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ endif (BLAS_LIBRARIES)
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.3-1.5.patch b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.3-1.5.patch
new file mode 100644
index 0000000000..0ea87500b0
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.3-1.5.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index a8e9769536..f0f91304c2 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -107,7 +107,7 @@ else()
+ set(AT_MKLDNN_ENABLED 0)
+ set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;FLAME")
++set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2;FLAME")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+
+ if(BLAS STREQUAL "Eigen")
+@@ -147,6 +147,20 @@ elseif(BLAS STREQUAL "vecLib")
+ find_package(vecLib REQUIRED)
+ include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
+ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ message(STATUS "SSL2 Selected BLAS library")
++ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++ set(SSL2_FOUND ON)
++ message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ set(WITH_BLAS "ssl2")
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
+ else()
+ message(FATAL_ERROR "Unrecognized BLAS option: " ${BLAS})
+ endif()
+@@ -156,7 +170,7 @@ if (NOT INTERN_BUILD_MOBILE)
+ set(AT_MKL_ENABLED 0)
+ set(AT_MKL_MT 0)
+ set(USE_BLAS 1)
+- if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND))
++ if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND))
+ message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+ find_package(BLAS)
+ if (NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index e93e98a609..d43a6c40bd 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -239,6 +239,28 @@ if((NOT BLAS_LIBRARIES)
+ endif (BLAS_LIBRARIES)
+ endif()
+
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ check_fortran_libraries(
++ BLAS_LIBRARIES
++ BLAS
++ sgemm
++ "-SSL2;--linkfortran"
++ "fjlapackexsve")
++ if (BLAS_LIBRARIES)
++ set(BLAS_INFO "ssl2")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ endif (BLAS_LIBRARIES)
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.6-1.7.patch b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.6-1.7.patch
new file mode 100644
index 0000000000..423af3f212
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.6-1.7.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 36e1ab7682..0f02f51c47 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -114,7 +114,7 @@ else()
+ set(AT_MKLDNN_ENABLED 0)
+ set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;FLAME;Generic")
++set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2;FLAME;Generic")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+
+ if(BLAS STREQUAL "Eigen")
+@@ -154,6 +154,20 @@ elseif(BLAS STREQUAL "vecLib")
+ find_package(vecLib REQUIRED)
+ include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
+ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ message(STATUS "SSL2 Selected BLAS library")
++ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++ set(SSL2_FOUND ON)
++ message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ set(WITH_BLAS "ssl2")
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
+ elseif(BLAS STREQUAL "Generic")
+ # On Debian family, the CBLAS ABIs have been merged into libblas.so
+ find_library(BLAS_LIBRARIES blas)
+@@ -168,7 +182,7 @@ if(NOT INTERN_BUILD_MOBILE)
+ set(AT_MKL_ENABLED 0)
+ set(AT_MKL_MT 0)
+ set(USE_BLAS 1)
+- if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR GENERIC_BLAS_FOUND))
++ if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND OR GENERIC_BLAS_FOUND))
+ message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+ find_package(BLAS)
+ if(NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index e93e98a609..d43a6c40bd 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -239,6 +239,28 @@ if((NOT BLAS_LIBRARIES)
+ endif (BLAS_LIBRARIES)
+ endif()
+
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ check_fortran_libraries(
++ BLAS_LIBRARIES
++ BLAS
++ sgemm
++ "-SSL2;--linkfortran"
++ "fjlapackexsve")
++ if (BLAS_LIBRARIES)
++ set(BLAS_INFO "ssl2")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ endif (BLAS_LIBRARIES)
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.8.patch b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.8.patch
new file mode 100644
index 0000000000..461c1a2976
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.8.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 06464e799a..7f50bd8fa0 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -118,7 +118,7 @@ else()
+ set(AT_MKLDNN_ENABLED 0)
+ set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;FLAME;Generic")
++set_property(CACHE BLAS PROPERTY STRINGS "Eigen;ATLAS;OpenBLAS;MKL;vecLib;SSL2;FLAME;Generic")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+
+ if(BLAS STREQUAL "Eigen")
+@@ -157,6 +157,20 @@ elseif(BLAS STREQUAL "vecLib")
+ find_package(vecLib REQUIRED)
+ include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
+ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ message(STATUS "SSL2 Selected BLAS library")
++ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++ set(SSL2_FOUND ON)
++ message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ set(WITH_BLAS "ssl2")
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
+ elseif(BLAS STREQUAL "Generic")
+ # On Debian family, the CBLAS ABIs have been merged into libblas.so
+ find_library(BLAS_LIBRARIES blas)
+@@ -171,7 +185,7 @@ if(NOT INTERN_BUILD_MOBILE)
+ set(AT_MKL_ENABLED 0)
+ set(AT_MKL_MT 0)
+ set(USE_BLAS 1)
+- if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR GENERIC_BLAS_FOUND))
++ if(NOT (ATLAS_FOUND OR OpenBLAS_FOUND OR MKL_FOUND OR VECLIB_FOUND OR SSL2_FOUND OR GENERIC_BLAS_FOUND))
+ message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+ find_package(BLAS)
+ if(NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index e8f5d7c950..29219e057f 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -257,6 +257,28 @@ if((NOT BLAS_LIBRARIES)
+ endif()
+ endif()
+
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ check_fortran_libraries(
++ BLAS_LIBRARIES
++ BLAS
++ sgemm
++ "-SSL2;--linkfortran"
++ "fjlapackexsve")
++ if (BLAS_LIBRARIES)
++ set(BLAS_INFO "ssl2")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ endif (BLAS_LIBRARIES)
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.9.patch b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.9.patch
new file mode 100644
index 0000000000..0febb57586
--- /dev/null
+++ b/var/spack/repos/builtin/packages/py-torch/fj-ssl2_1.9.patch
@@ -0,0 +1,76 @@
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index 5d57b9ca78..a74fe73b9f 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -118,7 +118,7 @@ else()
+ set(AT_MKLDNN_ENABLED 0)
+ set(AT_MKL_ENABLED 0)
+ endif()
+-set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;vecLib")
++set_property(CACHE BLAS PROPERTY STRINGS "ATLAS;BLIS;Eigen;FLAME;Generic;MKL;OpenBLAS;SSL2;vecLib")
+ message(STATUS "Trying to find preferred BLAS backend of choice: " ${BLAS})
+
+ if(BLAS STREQUAL "Eigen")
+@@ -161,6 +161,20 @@ elseif(BLAS STREQUAL "vecLib")
+ find_package(vecLib REQUIRED)
+ include_directories(SYSTEM ${vecLib_INCLUDE_DIR})
+ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${vecLib_LINKER_LIBS})
++elseif(BLAS STREQUAL "SSL2")
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ message(STATUS "SSL2 Selected BLAS library")
++ list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS "fjlapackexsve.so")
++ set(SSL2_FOUND ON)
++ message(STATUS "set CMAKE_SHARED_LINKER_FLAGS: -SSL2 --linkfortran")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ set(WITH_BLAS "ssl2")
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
+ elseif(BLAS STREQUAL "Generic")
+ # On Debian family, the CBLAS ABIs have been merged into libblas.so
+ find_library(BLAS_LIBRARIES blas)
+@@ -175,7 +189,7 @@ if(NOT INTERN_BUILD_MOBILE)
+ set(AT_MKL_ENABLED 0)
+ set(AT_MKL_MT 0)
+ set(USE_BLAS 1)
+- if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND))
++ if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR SSL2_FOUND OR VECLIB_FOUND))
+ message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
+ find_package(BLAS)
+ if(NOT BLAS_FOUND)
+diff --git a/cmake/Modules/FindBLAS.cmake b/cmake/Modules/FindBLAS.cmake
+index eefd6d475a..92ad75d32e 100644
+--- a/cmake/Modules/FindBLAS.cmake
++++ b/cmake/Modules/FindBLAS.cmake
+@@ -276,6 +276,28 @@ if((NOT BLAS_LIBRARIES)
+ endif()
+ endif()
+
++# BLAS in SSL2 library?
++if((NOT BLAS_LIBRARIES)
++ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "ssl2")))
++ if(CMAKE_CXX_COMPILER MATCHES ".*/FCC$"
++ AND CMAKE_C_COMPILER MATCHES ".*/fcc$")
++ check_fortran_libraries(
++ BLAS_LIBRARIES
++ BLAS
++ sgemm
++ "-SSL2;--linkfortran"
++ "fjlapackexsve")
++ if (BLAS_LIBRARIES)
++ set(BLAS_INFO "ssl2")
++ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -SSL2 --linkfortran")
++ endif (BLAS_LIBRARIES)
++ else()
++ message(STATUS "Not built using fcc and FCC.")
++ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
++ message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
++ endif()
++endif()
++
+ # Generic BLAS library?
+ if((NOT BLAS_LIBRARIES)
+ AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "generic")))
diff --git a/var/spack/repos/builtin/packages/py-torch/package.py b/var/spack/repos/builtin/packages/py-torch/package.py
index 60bef24291..59248a3191 100644
--- a/var/spack/repos/builtin/packages/py-torch/package.py
+++ b/var/spack/repos/builtin/packages/py-torch/package.py
@@ -206,6 +206,15 @@ class PyTorch(PythonPackage, CudaPackage):
# to detect openmp settings used by Fujitsu compiler.
patch('detect_omp_of_fujitsu_compiler.patch', when='%fj')
+ # Fixes to build with fujitsu-ssl2
+ patch('fj-ssl2_1.11.patch', when='@1.11:^fujitsu-ssl2')
+ patch('fj-ssl2_1.10.patch', when='@1.10^fujitsu-ssl2')
+ patch('fj-ssl2_1.9.patch', when='@1.9^fujitsu-ssl2')
+ patch('fj-ssl2_1.8.patch', when='@1.8^fujitsu-ssl2')
+ patch('fj-ssl2_1.6-1.7.patch', when='@1.6:1.7^fujitsu-ssl2')
+ patch('fj-ssl2_1.3-1.5.patch', when='@1.3:1.5^fujitsu-ssl2')
+ patch('fj-ssl2_1.2.patch', when='@1.2^fujitsu-ssl2')
+
# Fix compilation of +distributed~tensorpipe
# https://github.com/pytorch/pytorch/issues/68002
patch('https://github.com/pytorch/pytorch/commit/c075f0f633fa0136e68f0a455b5b74d7b500865c.patch?full_index=1',
@@ -371,6 +380,9 @@ class PyTorch(PythonPackage, CudaPackage):
elif self.spec['blas'].name == 'veclibfort':
env.set('BLAS', 'vecLib')
env.set('WITH_BLAS', 'veclib')
+ elif self.spec['blas'].name == 'fujitsu-ssl2':
+ env.set('BLAS', 'SSL2')
+ env.set('WITH_BLAS', 'ssl2')
else:
env.set('BLAS', 'Generic')
env.set('WITH_BLAS', 'generic')