diff --git a/.github/workflows/build-magma-linux.yml b/.github/workflows/build-magma-linux.yml deleted file mode 100644 index e7da485ca..000000000 --- a/.github/workflows/build-magma-linux.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: build-linux-magma - -on: - push: - branches: - main - paths: - - magma/* - - magma/package_files/* - - common/install_conda.sh - - .github/workflows/build-magma-linux.yml - pull_request: - paths: - - magma/* - - magma/package_files/* - - common/install_conda.sh - - .github/workflows/build-magma-linux.yml - -# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 -defaults: - run: - shell: bash -x -e -l {0} -env: - BUILD_ENVIRONMENT: build-linux-magma - IN_CI: 1 - IS_GHA: 1 - -jobs: - build-linux-magma: - runs-on: linux.2xlarge - strategy: - matrix: - cuda_version: ["126", "124", "121", "118"] - steps: - - name: Checkout PyTorch builder - uses: actions/checkout@v3 - - name: Build Magma Cuda - working-directory: magma - run: | - make magma-cuda${{ matrix.cuda_version }} - - name: Save as artifact - uses: actions/upload-artifact@v4 - with: - path: magma/output/linux-64/magma-cuda*.bz2 - - name: Install conda - uses: conda-incubator/setup-miniconda@v2 - with: - python-version: 3.8 - auto-update-conda: true - miniconda-version: "latest" - activate-environment: build-linux-magma - - name: Conda install anaconda-client - shell: bash -l {0} - run: | - conda install -y conda-build anaconda-client - - name: Push MAGMA to anaconda - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - run: | - anaconda --token $ANACONDA_TOKEN upload -u pytorch --force magma/output/linux-64/magma-cuda*.bz2 - env: - ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} diff --git a/.github/workflows/build-magma-windows.yml b/.github/workflows/build-magma-windows.yml deleted file mode 100644 index 3a8d4d5a3..000000000 --- a/.github/workflows/build-magma-windows.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Build MAGMA for Windows - -on: - push: - branches: - main - paths: - - windows/internal/build_magma.bat - - .github/workflows/build-magma-windows.yml - pull_request: - paths: - - windows/internal/build_magma.bat - - .github/workflows/build-magma-windows.yml - -jobs: - build-windows-magma: - runs-on: windows-2019 - strategy: - matrix: - cuda_version: ["126", "124", "118"] - config: ["Release", "Debug"] - env: - CUDA_VERSION: ${{ matrix.cuda_version }} - CONFIG: ${{ matrix.config }} - steps: - - name: Checkout pytorch/builder - uses: actions/checkout@v3 - - name: Enable MSVC dev commands to enable cl.exe # FYI incompatible with shell: bash - uses: ilammy/msvc-dev-cmd@dd5e2fa0a7de1e7929605d9ecc020e749d9856a3 - - name: Install CUDA Toolkit - run: windows/internal/cuda_install.bat - - name: Build MAGMA and push to S3 - run: windows/internal/build_magma.bat - - name: Save as artifact - uses: actions/upload-artifact@v4 - with: - path: magma_*_cuda*_*.7z - overwrite: true - name: artifact_${{ matrix.cuda_version }}_${{ matrix.config }} - push-windows-magma: - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - environment: magma - runs-on: ubuntu-22.04 - needs: build-windows-magma - steps: - - name: Download all artifacts - uses: actions/download-artifact@v4 - - name: Push MAGMA to S3 - run: | - # Setting the following variable avoids errors in GHA https://github.com/aws/aws-cli/issues/5623 - cd artifact - export AWS_EC2_METADATA_DISABLED=true - aws s3 cp . $OSSCI_WINDOWS_S3 --exclude="*" --include="magma_*_cuda*.7z" --recursive --acl public-read - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_OSSCI_S3_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_OSSCI_S3_ACCESS_KEY }} - OSSCI_WINDOWS_S3: s3://ossci-windows/ diff --git a/CUDA_UPGRADE_GUIDE.MD b/CUDA_UPGRADE_GUIDE.MD index 58897bee2..46f0c1f95 100644 --- a/CUDA_UPGRADE_GUIDE.MD +++ b/CUDA_UPGRADE_GUIDE.MD @@ -49,11 +49,11 @@ There are three types of Docker containers we maintain in order to build Linux b 10. Validate conda-builder docker hub [cuda11.6](https://hub.docker.com/r/pytorch/conda-builder/tags?page=1&name=cuda11.6) to see that images have been built and correctly tagged. These images are used in the next step to build Magma for linux. ## 3. Update Magma for Linux -Build Magma for Linux. Our Linux CUDA jobs use conda, so we need to build magma-cuda116 and push it to anaconda: -1. Follow this [PR 1368](https://github.com/pytorch/builder/pull/1368) for all steps in this section +Build Magma for Linux. Our Linux CUDA jobs use conda, so we need to build magma-cuda and push it to the ossci-linux s3 bucket: +1. The code to build Magma is in the [`pytorch/pytorch` repo](https://github.com/pytorch/pytorch/tree/main/.ci/magma) 2. Currently, this is mainly copy-paste in [`magma/Makefile`](magma/Makefile) if there are no major code API changes/deprecations to the CUDA version. Previously, we've needed to add patches to MAGMA, so this may be something to check with NVIDIA about. -3. To push the package, please update build-magma-linux workflow [PR 897](https://github.com/pytorch/builder/pull/897). -4. NOTE: This step relies on the conda-builder image (changes to `.github/workflows/build-conda-images.yml`), so make sure you have pushed the new conda-builder prior. Validate this step by logging into anaconda.org and seeing your package deployed for example [here](https://anaconda.org/pytorch/magma-cuda115) +3. To push the package, please update [build-magma-linux workflow](https://github.com/pytorch/pytorch/blob/main/.github/workflows/build-magma-linux.yml) +4. NOTE: This step relies on the `pytorch/manylinux-builder:cuda${DESIRED_CUDA}-main` image (changes to [`.github/workflows/build-manywheel-images.yml`](https://github.com/pytorch/pytorch/blob/7d4f5f7508d3166af58fdcca8ff01a5b426af067/.github/workflows/build-manywheel-images.yml#L52)), so make sure you have pushed the new manywheel-builder prior. ## 4. Modify scripts to install the new CUDA for Libtorch and Manywheel Docker Linux containers. Modify builder supporting scripts There are three types of Docker containers we maintain in order to build Linux binaries: `conda`, `libtorch`, and `manywheel`. They all require installing CUDA and then updating code references in respective build scripts/Dockerfiles. This step is about libtorch and manywheel containers. @@ -75,7 +75,7 @@ Add setup for our Docker `libtorch` and `manywheel`: 5. NOTE: When you upload files to S3, make sure to make these objects publicly readable so that our CI can access them! 6. Most times, you have to upgrade the driver install for newer versions, which would look like [updating the `windows/internal/driver_update.bat` file](https://github.com/pytorch/builder/commit/9b997037e16eb3bc635e28d101c3297d7e4ead29) 1. Please check the CUDA Toolkit and Minimum Required Driver Version for CUDA minor version compatibility table in [the release notes](https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html) to see if a driver update is necessary. -7. Compile MAGMA with the new CUDA version. Update `.github/workflows/build-magma-windows.yml` to include new version. +7. Compile MAGMA with the new CUDA version. Update [`.github/workflows/build-magma-windows.yml`](https://github.com/pytorch/pytorch/blob/7d4f5f7508d3166af58fdcca8ff01a5b426af067/.github/workflows/build-magma-windows.yml#L25) to include new version. 8. Validate Magma builds by going to S3 [ossci-windows](https://s3.console.aws.amazon.com/s3/buckets/ossci-windows?region=us-east-1&tab=objects). And querying for ```magma_``` ## 6. Generate new Windows AMI, test and deploy to canary and prod. diff --git a/magma/.gitignore b/magma/.gitignore deleted file mode 100644 index cf874d9dd..000000000 --- a/magma/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -output/ -magma-cuda*/ diff --git a/magma/Makefile b/magma/Makefile deleted file mode 100644 index 93d78aaf8..000000000 --- a/magma/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -SHELL=/usr/bin/env bash - -DESIRED_CUDA ?= 11.8 -PACKAGE_NAME ?= magma-cuda118 -CUDA_ARCH_LIST ?= -gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90 - -DOCKER_RUN = set -eou pipefail; docker run --rm -i \ - -v $(shell git rev-parse --show-toplevel):/builder \ - -w /builder \ - -e DESIRED_CUDA=${DESIRED_CUDA} \ - -e PACKAGE_NAME=${PACKAGE_NAME} \ - -e CUDA_ARCH_LIST="${CUDA_ARCH_LIST}" \ - "pytorch/conda-builder:cuda${DESIRED_CUDA}" \ - magma/build_magma.sh - -.PHONY: all -all: magma-cuda126 -all: magma-cuda124 -all: magma-cuda121 -all: magma-cuda118 - -.PHONY: -clean: - $(RM) -r magma-* - $(RM) -r output - -.PHONY: magma-cuda126 -magma-cuda126: DESIRED_CUDA := 12.6 -magma-cuda126: PACKAGE_NAME := magma-cuda126 -magma-cuda126: - $(DOCKER_RUN) - -.PHONY: magma-cuda124 -magma-cuda124: DESIRED_CUDA := 12.4 -magma-cuda124: PACKAGE_NAME := magma-cuda124 -magma-cuda124: - $(DOCKER_RUN) - -.PHONY: magma-cuda121 -magma-cuda121: DESIRED_CUDA := 12.1 -magma-cuda121: PACKAGE_NAME := magma-cuda121 -magma-cuda121: - $(DOCKER_RUN) - -.PHONY: magma-cuda118 -magma-cuda118: DESIRED_CUDA := 11.8 -magma-cuda118: PACKAGE_NAME := magma-cuda118 -magma-cuda118: CUDA_ARCH_LIST += -gencode arch=compute_37,code=sm_37 -magma-cuda118: - $(DOCKER_RUN) - diff --git a/magma/README.md b/magma/README.md deleted file mode 100644 index 153efcb2a..000000000 --- a/magma/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Magma - -## Building - -Look in the `Makefile` for available targets to build. To build any target, for example `magma-cuda111`, run - -``` -make magma-cuda111 -``` - -This should spawn a docker image with `devtoolset3` installed in order to keep binary size down. Within the docker image, it should run `build_magma.sh` with the correct environment variables set, which should package the necessary files with `conda build`. - -More specifically, `build_magma.sh` copies over the relevant files from the `package_files` directory depending on the CUDA version. More information on conda-build can be found [here](https://docs.conda.io/projects/conda-build/en/latest/concepts/recipe.html). - -Outputted binaries should be in the `output` folder. - -## Pushing - -Once you have built the binaries push them with: - -``` -anaconda upload -u pytorch --force output/*/magma-cuda*.bz2 -``` - -If you do not have upload permissions, please ping @seemethere or @soumith to gain access - -## New versions - -New CUDA versions can be added by creating a new make target with the next desired version. For CUDA version NN.n, the target should be named `magma-cudaNNn`. - -Make sure to edit the appropriate environment variables (e.g., DESIRED_CUDA, CUDA_ARCH_LIST, PACKAGE_NAME) in the `Makefile` accordingly. Remember also to check `build_magma.sh` to ensure the logic for copying over the files remains correct. - -New patches can be added by editing `Makefile`, `build_magma.sh`, and `package_files/meta.yaml` the same way `cudaPointerAttributes.patch` is implemented. diff --git a/magma/build_magma.sh b/magma/build_magma.sh deleted file mode 100755 index a577c7d45..000000000 --- a/magma/build_magma.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -set -eou pipefail - -# Create a folder to be packaged -PACKAGE_DIR=magma/${PACKAGE_NAME} -PACKAGE_FILES=magma/package_files -mkdir ${PACKAGE_DIR} -cp ${PACKAGE_FILES}/build.sh ${PACKAGE_DIR}/build.sh -cp ${PACKAGE_FILES}/meta.yaml ${PACKAGE_DIR}/meta.yaml -cp ${PACKAGE_FILES}/thread_queue.patch ${PACKAGE_DIR}/thread_queue.patch -cp ${PACKAGE_FILES}/cmakelists.patch ${PACKAGE_DIR}/cmakelists.patch -cp ${PACKAGE_FILES}/getrf_shfl.patch ${PACKAGE_DIR}/getrf_shfl.patch -cp ${PACKAGE_FILES}/getrf_nbparam.patch ${PACKAGE_DIR}/getrf_nbparam.patch -cp ${PACKAGE_FILES}/CMake.patch ${PACKAGE_DIR}/CMake.patch - -conda install -yq conda-build conda-verify -. ./conda/switch_cuda_version.sh "${DESIRED_CUDA}" -( - set -x - conda build --output-folder magma/output "${PACKAGE_DIR}" -) diff --git a/magma/package_files/CMake.patch b/magma/package_files/CMake.patch deleted file mode 100644 index 5d4636bfa..000000000 --- a/magma/package_files/CMake.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- CMake.src.cuda 2023-03-29 10:05:32.136954140 +0000 -+++ CMake.src.cuda 2023-03-29 10:05:50.281318043 +0000 -@@ -283,10 +283,10 @@ - magmablas/zgeadd.cu - magmablas/zgeadd2.cu - magmablas/zgeam.cu --magmablas/zgemm_fermi.cu -+#magmablas/zgemm_fermi.cu - magmablas/zgemm_reduce.cu - magmablas/zgemv_conj.cu --magmablas/zgemv_fermi.cu -+#magmablas/zgemv_fermi.cu - magmablas/zgerbt.cu - magmablas/zgerbt_kernels.cu - magmablas/zgetmatrix_transpose.cpp -@@ -1009,18 +1009,18 @@ - magmablas/sgeam.cu - magmablas/dgeam.cu - magmablas/cgeam.cu --magmablas/sgemm_fermi.cu --magmablas/dgemm_fermi.cu --magmablas/cgemm_fermi.cu -+#magmablas/sgemm_fermi.cu -+#magmablas/dgemm_fermi.cu -+#magmablas/cgemm_fermi.cu - magmablas/sgemm_reduce.cu - magmablas/dgemm_reduce.cu - magmablas/cgemm_reduce.cu - magmablas/sgemv_conj.cu - magmablas/dgemv_conj.cu - magmablas/cgemv_conj.cu --magmablas/sgemv_fermi.cu --magmablas/dgemv_fermi.cu --magmablas/cgemv_fermi.cu -+#magmablas/sgemv_fermi.cu -+#magmablas/dgemv_fermi.cu -+#magmablas/cgemv_fermi.cu - magmablas/sgerbt.cu - magmablas/dgerbt.cu - magmablas/cgerbt.cu diff --git a/magma/package_files/build.sh b/magma/package_files/build.sh deleted file mode 100644 index 6d40748d4..000000000 --- a/magma/package_files/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -export CMAKE_LIBRARY_PATH=$PREFIX/lib:$PREFIX/include:$CMAKE_LIBRARY_PATH -export CMAKE_PREFIX_PATH=$PREFIX -export PATH=$PREFIX/bin:$PATH - -CUDA__VERSION=$(nvcc --version|sed -n 4p|cut -f5 -d" "|cut -f1 -d",") -if [ "$CUDA__VERSION" != "$DESIRED_CUDA" ]; then - echo "CUDA Version is not $DESIRED_CUDA. CUDA Version found: $CUDA__VERSION" - exit 1 -fi - -mkdir build -cd build -cmake .. -DUSE_FORTRAN=OFF -DGPU_TARGET="All" -DCMAKE_INSTALL_PREFIX=$PREFIX -DCUDA_ARCH_LIST="$CUDA_ARCH_LIST" -make -j$(getconf _NPROCESSORS_CONF) -make install -cd .. diff --git a/magma/package_files/cmakelists.patch b/magma/package_files/cmakelists.patch deleted file mode 100644 index 52c21720d..000000000 --- a/magma/package_files/cmakelists.patch +++ /dev/null @@ -1,388 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index d5d8d87d..8a507334 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -3,7 +3,7 @@ cmake_minimum_required( VERSION 2.8.1 ) - # ---------------------------------------- - # to disable Fortran, set this to "off" - # see also -DADD_ below --option( USE_FORTRAN "Fortran is required for some tester checks, but can be disabled with reduced functionality" ON ) -+option( USE_FORTRAN "Fortran is required for some tester checks, but can be disabled with reduced functionality" OFF ) - - if (USE_FORTRAN) - project( MAGMA C CXX Fortran ) -@@ -75,6 +75,8 @@ else() - message( WARNING "The compiler ${CMAKE_CXX_COMPILER} doesn't support the -std=c++11 flag. Some code may not compile.") - endif() - -+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -fno-exceptions") -+ - CHECK_C_COMPILER_FLAG("-std=c99" COMPILER_SUPPORTS_C99) - if (COMPILER_SUPPORTS_C99) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99") -@@ -101,15 +103,15 @@ endif() - - - # ---------------------------------------- --# locate OpenMP --find_package( OpenMP ) --if (OPENMP_FOUND) -- message( STATUS "Found OpenMP" ) -- message( STATUS " OpenMP_C_FLAGS ${OpenMP_C_FLAGS}" ) -- message( STATUS " OpenMP_CXX_FLAGS ${OpenMP_CXX_FLAGS}" ) -- set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" ) -- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" ) --endif() -+# # locate OpenMP -+# find_package( OpenMP ) -+# if (OPENMP_FOUND) -+# message( STATUS "Found OpenMP" ) -+# message( STATUS " OpenMP_C_FLAGS ${OpenMP_C_FLAGS}" ) -+# message( STATUS " OpenMP_CXX_FLAGS ${OpenMP_CXX_FLAGS}" ) -+# set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" ) -+# set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" ) -+# endif() - - if (MAGMA_ENABLE_CUDA) - # ---------------------------------------- -@@ -132,7 +134,7 @@ if (MAGMA_ENABLE_CUDA) - set( NV_SM "" ) - set( NV_COMP "" ) - -- set(CUDA_SEPARABLE_COMPILATION ON) -+ set(CUDA_SEPARABLE_COMPILATION OFF) - - # nvcc >= 6.5 supports -std=c++11, so propagate CXXFLAGS to NVCCFLAGS. - # Older nvcc didn't support -std=c++11, so previously we disabled propagation. -@@ -294,11 +296,18 @@ if (MAGMA_ENABLE_CUDA) - message( STATUS " compile for CUDA arch 8.0 (Ampere)" ) - endif() - -+ if ( ${GPU_TARGET} MATCHES "All") -+ set( MIN_ARCH 370) -+ SET( NV_SM ${CUDA_ARCH_LIST}) -+ SET( NV_COMP "") -+ endif() -+ - if (NOT MIN_ARCH) - message( FATAL_ERROR "GPU_TARGET must contain one or more of Fermi, Kepler, Maxwell, Pascal, Volta, Turing, Ampere, or valid sm_[0-9][0-9]" ) - endif() - -- set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -Xcompiler -fPIC ${NV_SM} ${NV_COMP} ${FORTRAN_CONVENTION} ) -+ set( CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS} -DHAVE_CUBLAS -Xfatbin -compress-all -Xcompiler -fPIC -std=c++11 ${NV_SM} ${NV_COMP} ${FORTRAN_CONVENTION} ) -+ MESSAGE(STATUS "CUDA_NVCC_FLAGS: ${CUDA_NVCC_FLAGS}") - #add_definitions( "-DMAGMA_HAVE_CUDA -DMAGMA_CUDA_ARCH_MIN=${MIN_ARCH}" ) - set(MAGMA_HAVE_CUDA "1") - set(MAGMA_CUDA_ARCH_MIN "${MIN_ARCH}") -@@ -413,7 +422,7 @@ set_property(CACHE BLA_VENDOR PROPERTY STRINGS - set( LAPACK_LIBRARIES "" CACHE STRING "Libraries for LAPACK and BLAS, to manually override search" ) - if (LAPACK_LIBRARIES STREQUAL "") - message( STATUS "Searching for BLAS and LAPACK. To override, set LAPACK_LIBRARIES using ccmake." ) -- find_package( LAPACK ) -+ # find_package( LAPACK ) - # force showing updated LAPACK_LIBRARIES in ccmake / cmake-gui. - set( LAPACK_LIBRARIES ${LAPACK_LIBRARIES} CACHE STRING "Libraries for LAPACK and BLAS, to manually override search" FORCE ) - else() -@@ -552,12 +561,12 @@ if (WIN32) - #message( "libmagma_all_f ${libmagma_all_f}" ) - - # on Windows, Fortran files aren't compiled if listed here... -- cuda_add_library( magma ${libmagma_all_cpp} ) -+ cuda_add_library( magma STATIC ${libmagma_all_cpp} OPTIONS --compiler-options "-fPIC") - target_link_libraries( magma - ${LAPACK_LIBRARIES} - ${CUDA_CUDART_LIBRARY} - ${CUDA_CUBLAS_LIBRARIES} -- ${CUDA_cusparse_LIBRARY} -+ # ${CUDA_cusparse_LIBRARY} - ) - - # no Fortran files at the moment (how to test libmagma_all_f is not empty?), -@@ -575,13 +584,13 @@ if (WIN32) - else() - # Unix doesn't seem to have a problem with mixing C, CUDA, and Fortran files - if (MAGMA_ENABLE_CUDA) -- cuda_add_library( magma ${libmagma_all} ) -+ cuda_add_library( magma STATIC ${libmagma_all} OPTIONS --compiler-options "-fPIC") - target_link_libraries( magma - ${blas_fix} - ${LAPACK_LIBRARIES} - ${CUDA_CUDART_LIBRARY} - ${CUDA_CUBLAS_LIBRARIES} -- ${CUDA_cusparse_LIBRARY} -+ # ${CUDA_cusparse_LIBRARY} - ) - else() - find_package( hipBLAS ) -@@ -614,138 +623,139 @@ else() - endif() - endif() - add_custom_target( lib DEPENDS magma ) -- -- --# ---------------------------------------- --# compile lapacktest library --# If use fortran, compile only Fortran files, not magma_[sdcz]_no_fortran.cpp --# else, compile only C++ files, not Fortran files --if (USE_FORTRAN) -- foreach( filename ${liblapacktest_all} ) -- if (filename MATCHES "\\.(f|f90|F90)$") -- list( APPEND liblapacktest_all_f ${filename} ) -- endif() -- endforeach() -- add_library( lapacktest ${liblapacktest_all_f} ) --else() -- # alternatively, use only C/C++/CUDA files, including magma_[sdcz]_no_fortran.cpp -- foreach( filename ${liblapacktest_all} ) -- if (filename MATCHES "\\.(c|cu|cpp)$") -- list( APPEND liblapacktest_all_cpp ${filename} ) -- endif() -- endforeach() -- add_library( lapacktest ${liblapacktest_all_cpp} ) --endif() --target_link_libraries( lapacktest -- ${blas_fix} -- ${LAPACK_LIBRARIES} --) -- -- --# ---------------------------------------- --# compile tester library --add_library( tester ${libtest_all} ) --target_link_libraries( tester -- magma -- lapacktest -- ${blas_fix} -- ${LAPACK_LIBRARIES} --) -+set_target_properties(magma PROPERTIES POSITION_INDEPENDENT_CODE ON) -+ -+ -+# # ---------------------------------------- -+# # compile lapacktest library -+# # If use fortran, compile only Fortran files, not magma_[sdcz]_no_fortran.cpp -+# # else, compile only C++ files, not Fortran files -+# if (USE_FORTRAN) -+# foreach( filename ${liblapacktest_all} ) -+# if (filename MATCHES "\\.(f|f90|F90)$") -+# list( APPEND liblapacktest_all_f ${filename} ) -+# endif() -+# endforeach() -+# add_library( lapacktest ${liblapacktest_all_f} ) -+# else() -+# # alternatively, use only C/C++/CUDA files, including magma_[sdcz]_no_fortran.cpp -+# foreach( filename ${liblapacktest_all} ) -+# if (filename MATCHES "\\.(c|cu|cpp)$") -+# list( APPEND liblapacktest_all_cpp ${filename} ) -+# endif() -+# endforeach() -+# add_library( lapacktest ${liblapacktest_all_cpp} ) -+# endif() -+# target_link_libraries( lapacktest -+# ${blas_fix} -+# ${LAPACK_LIBRARIES} -+# ) -+ -+ -+# # ---------------------------------------- -+# # compile tester library -+# add_library( tester ${libtest_all} ) -+# target_link_libraries( tester -+# magma -+# lapacktest -+# ${blas_fix} -+# ${LAPACK_LIBRARIES} -+# ) - - - # ---------------------------------------- - # compile MAGMA sparse library - - # sparse doesn't have Fortran at the moment, so no need for above shenanigans --if (MAGMA_ENABLE_CUDA) -- include_directories( sparse/include ) -- include_directories( sparse/control ) --else() -- include_directories( sparse_hip/include ) -- include_directories( sparse_hip/control ) --endif() --include_directories( testing ) -- --if (MAGMA_ENABLE_CUDA) -- cuda_add_library( magma_sparse ${libsparse_all} ) -- target_link_libraries( magma_sparse -- magma -- ${blas_fix} -- ${LAPACK_LIBRARIES} -- ${CUDA_CUDART_LIBRARY} -- ${CUDA_CUBLAS_LIBRARIES} -- ${CUDA_cusparse_LIBRARY} -- ) --else() -- add_library( magma_sparse ${libsparse_all} ) -- target_link_libraries( magma_sparse -- magma -- ${blas_fix} -- ${LAPACK_LIBRARIES} -- hip::device -- roc::hipblas -- roc::hipsparse -- ) --endif() --add_custom_target( sparse-lib DEPENDS magma_sparse ) -- -- --# ---------------------------------------- --# compile each tester -- --# save testers to testing/ --# save tester lib files to testing_lib/ to avoid cluttering lib/ --set( CMAKE_RUNTIME_OUTPUT_DIRECTORY testing ) --set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY testing_lib ) --set( CMAKE_LIBRARY_OUTPUT_DIRECTORY testing_lib ) -- --# skip Fortran testers, which require an extra file from CUDA --foreach( filename ${testing_all} ) -- if (filename MATCHES "\\.(c|cu|cpp)$") -- list( APPEND testing_all_cpp ${filename} ) -- endif() --endforeach() --foreach( TEST ${testing_all_cpp} ) -- string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} ) -- string( REGEX REPLACE "testing/" "" EXE ${EXE} ) -- #message( "${TEST} --> ${EXE}" ) -- add_executable( ${EXE} ${TEST} ) -- target_link_libraries( ${EXE} tester lapacktest magma ) -- list( APPEND testing ${EXE} ) --endforeach() --add_custom_target( testing DEPENDS ${testing} ) -- -- --# ---------------------------------------- --# compile each sparse tester -- --if (MAGMA_ENABLE_CUDA) -- set(SPARSE_TEST_DIR "sparse/testing") --else() -- set(SPARSE_TEST_DIR "sparse_hip/testing") --endif() -- -- --set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${SPARSE_TEST_DIR}" ) --cmake_policy( SET CMP0037 OLD) --foreach( TEST ${sparse_testing_all} ) -- string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} ) -- string( REGEX REPLACE "${SPARSE_TEST_DIR}/" "" EXE ${EXE} ) -- #message( "${TEST} --> ${EXE}" ) -- add_executable( ${EXE} ${TEST} ) -- target_link_libraries( ${EXE} magma_sparse magma ) -- list( APPEND sparse-testing ${EXE} ) --endforeach() --add_custom_target( sparse-testing DEPENDS ${sparse-testing} ) -+# if (MAGMA_ENABLE_CUDA) -+# include_directories( sparse/include ) -+# include_directories( sparse/control ) -+# else() -+# include_directories( sparse_hip/include ) -+# include_directories( sparse_hip/control ) -+# endif() -+# include_directories( testing ) -+ -+# if (MAGMA_ENABLE_CUDA) -+# cuda_add_library( magma_sparse ${libsparse_all} ) -+# target_link_libraries( magma_sparse -+# magma -+# ${blas_fix} -+# ${LAPACK_LIBRARIES} -+# ${CUDA_CUDART_LIBRARY} -+# ${CUDA_CUBLAS_LIBRARIES} -+# ${CUDA_cusparse_LIBRARY} -+# ) -+# else() -+# add_library( magma_sparse ${libsparse_all} ) -+# target_link_libraries( magma_sparse -+# magma -+# ${blas_fix} -+# ${LAPACK_LIBRARIES} -+# hip::device -+# roc::hipblas -+# roc::hipsparse -+# ) -+# endif() -+# add_custom_target( sparse-lib DEPENDS magma_sparse ) -+ -+ -+# # ---------------------------------------- -+# # compile each tester -+ -+# # save testers to testing/ -+# # save tester lib files to testing_lib/ to avoid cluttering lib/ -+# set( CMAKE_RUNTIME_OUTPUT_DIRECTORY testing ) -+# set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY testing_lib ) -+# set( CMAKE_LIBRARY_OUTPUT_DIRECTORY testing_lib ) -+ -+# # skip Fortran testers, which require an extra file from CUDA -+# foreach( filename ${testing_all} ) -+# if (filename MATCHES "\\.(c|cu|cpp)$") -+# list( APPEND testing_all_cpp ${filename} ) -+# endif() -+# endforeach() -+# foreach( TEST ${testing_all_cpp} ) -+# string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} ) -+# string( REGEX REPLACE "testing/" "" EXE ${EXE} ) -+# #message( "${TEST} --> ${EXE}" ) -+# add_executable( ${EXE} ${TEST} ) -+# target_link_libraries( ${EXE} tester lapacktest magma ) -+# list( APPEND testing ${EXE} ) -+# endforeach() -+# add_custom_target( testing DEPENDS ${testing} ) -+ -+ -+# # ---------------------------------------- -+# # compile each sparse tester -+ -+# if (MAGMA_ENABLE_CUDA) -+# set(SPARSE_TEST_DIR "sparse/testing") -+# else() -+# set(SPARSE_TEST_DIR "sparse_hip/testing") -+# endif() -+ -+ -+# set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${SPARSE_TEST_DIR}" ) -+# cmake_policy( SET CMP0037 OLD) -+# foreach( TEST ${sparse_testing_all} ) -+# string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} ) -+# string( REGEX REPLACE "${SPARSE_TEST_DIR}/" "" EXE ${EXE} ) -+# #message( "${TEST} --> ${EXE}" ) -+# add_executable( ${EXE} ${TEST} ) -+# target_link_libraries( ${EXE} magma_sparse magma ) -+# list( APPEND sparse-testing ${EXE} ) -+# endforeach() -+# add_custom_target( sparse-testing DEPENDS ${sparse-testing} ) - - - # ---------------------------------------- - # what to install --install( TARGETS magma magma_sparse ${blas_fix} -+install( TARGETS magma ${blas_fix} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib ) --file( GLOB headers include/*.h sparse/include/*.h "${CMAKE_BINARY_DIR}/include/*.h" ) -+file( GLOB headers include/*.h "${CMAKE_BINARY_DIR}/include/*.h" ) - if (USE_FORTRAN) - install( FILES ${headers} ${modules} - DESTINATION include ) -@@ -769,9 +779,9 @@ else() - "${blas_fix_lib} ${LAPACK_LIBS} hip::device roc::hipblas roc::hipsparse" ) - endif() - set( MAGMA_REQUIRED "" ) --configure_file( "${pkgconfig}.in" "${pkgconfig}" @ONLY ) --install( FILES "${CMAKE_BINARY_DIR}/${pkgconfig}" -- DESTINATION lib/pkgconfig ) -+# configure_file( "${pkgconfig}.in" "${pkgconfig}" @ONLY ) -+# install( FILES "${CMAKE_BINARY_DIR}/${pkgconfig}" -+# DESTINATION lib/pkgconfig ) - - # ---------------------------------------- - get_directory_property( compile_definitions COMPILE_DEFINITIONS ) diff --git a/magma/package_files/getrf_nbparam.patch b/magma/package_files/getrf_nbparam.patch deleted file mode 100644 index ce69c5281..000000000 --- a/magma/package_files/getrf_nbparam.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/control/get_batched_crossover.cpp b/control/get_batched_crossover.cpp -index 4ec57306..912f8608 100644 ---- a/control/get_batched_crossover.cpp -+++ b/control/get_batched_crossover.cpp -@@ -119,7 +119,7 @@ void magma_get_spotrf_batched_nbparam(magma_int_t n, magma_int_t *nb, magma_int_ - void magma_get_zgetrf_batched_nbparam(magma_int_t n, magma_int_t *nb, magma_int_t *recnb) - { - *nb = 64; -- *recnb = 32; -+ *recnb = 16; - return; - } - -@@ -127,7 +127,7 @@ void magma_get_zgetrf_batched_nbparam(magma_int_t n, magma_int_t *nb, magma_int_ - void magma_get_cgetrf_batched_nbparam(magma_int_t n, magma_int_t *nb, magma_int_t *recnb) - { - *nb = 128; -- *recnb = 32; -+ *recnb = 16; - return; - } - -@@ -135,7 +135,7 @@ void magma_get_cgetrf_batched_nbparam(magma_int_t n, magma_int_t *nb, magma_int_ - void magma_get_dgetrf_batched_nbparam(magma_int_t n, magma_int_t *nb, magma_int_t *recnb) - { - *nb = 128; -- *recnb = 32; -+ *recnb = 16; - return; - } - -@@ -143,7 +143,7 @@ void magma_get_dgetrf_batched_nbparam(magma_int_t n, magma_int_t *nb, magma_int_ - void magma_get_sgetrf_batched_nbparam(magma_int_t n, magma_int_t *nb, magma_int_t *recnb) - { - *nb = 128; -- *recnb = 32; -+ *recnb = 16; - return; - } - diff --git a/magma/package_files/getrf_shfl.patch b/magma/package_files/getrf_shfl.patch deleted file mode 100644 index 49baae012..000000000 --- a/magma/package_files/getrf_shfl.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/src/zgetrf_batched.cpp b/src/zgetrf_batched.cpp -index 24a65a90..884d9352 100644 ---- a/src/zgetrf_batched.cpp -+++ b/src/zgetrf_batched.cpp -@@ -116,7 +116,9 @@ magma_zgetrf_batched( - return magma_zgetrf_batched_smallsq_noshfl( m, dA_array, ldda, ipiv_array, info_array, batchCount, queue ); - } - else{ -- return magma_zgetrf_batched_smallsq_shfl( m, dA_array, ldda, ipiv_array, info_array, batchCount, queue ); -+ // magma_cgetrf_batched_smallsq_shfl is broken, therefore let's call noshfl version for arch < 700 -+ // return magma_zgetrf_batched_smallsq_shfl( m, dA_array, ldda, ipiv_array, info_array, batchCount, queue ); -+ return magma_zgetrf_batched_smallsq_noshfl( m, dA_array, ldda, ipiv_array, info_array, batchCount, queue ); - } - #else - return magma_zgetrf_batched_smallsq_noshfl( m, dA_array, ldda, ipiv_array, info_array, batchCount, queue ); diff --git a/magma/package_files/meta.yaml b/magma/package_files/meta.yaml deleted file mode 100644 index 1bd662f39..000000000 --- a/magma/package_files/meta.yaml +++ /dev/null @@ -1,23 +0,0 @@ -package: - name: "{{ environ.get('PACKAGE_NAME') }}" - version: 2.6.1 - -source: - url: http://icl.utk.edu/projectsfiles/magma/downloads/magma-2.6.1.tar.gz - patches: - - cmakelists.patch - - thread_queue.patch - - getrf_shfl.patch # incorrect results for <7.0 arch - - getrf_nbparam.patch # fixes "too many resources requested for launch" error - - CMake.patch # removes fermi for CUDA12+ - -build: - number: 1 - script_env: - - DESIRED_CUDA - - CUDA_ARCH_LIST - -about: - home: http://icl.cs.utk.edu/magma/software/index.html - license: BSD - license_file: COPYRIGHT diff --git a/magma/package_files/thread_queue.patch b/magma/package_files/thread_queue.patch deleted file mode 100644 index 1c2fa400f..000000000 --- a/magma/package_files/thread_queue.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- control/thread_queue.cpp 2016-08-30 06:37:49.000000000 -0700 -+++ control/thread_queue.cpp 2016-10-10 19:47:28.911580965 -0700 -@@ -15,7 +15,7 @@ - { - if ( err != 0 ) { - fprintf( stderr, "Error: %s (%d)\n", strerror(err), err ); -- throw std::exception(); -+ // throw std::exception(); - } - } - -@@ -172,7 +172,7 @@ - check( pthread_mutex_lock( &mutex )); - if ( quit_flag ) { - fprintf( stderr, "Error: push_task() called after quit()\n" ); -- throw std::exception(); -+ // throw std::exception(); - } - q.push( task ); - ntask += 1; diff --git a/windows/internal/build_magma.bat b/windows/internal/build_magma.bat deleted file mode 100644 index c33620005..000000000 --- a/windows/internal/build_magma.bat +++ /dev/null @@ -1,66 +0,0 @@ -@setlocal - -set MAGMA_VERSION=2.5.4 - -set CUVER_NODOT=%CUDA_VERSION% -set CUVER=%CUVER_NODOT:~0,-1%.%CUVER_NODOT:~-1,1% - -set CONFIG_LOWERCASE=%CONFIG:D=d% -set CONFIG_LOWERCASE=%CONFIG_LOWERCASE:R=r% -set CONFIG_LOWERCASE=%CONFIG_LOWERCASE:M=m% - -echo Building for configuration: %CONFIG_LOWERCASE%, %CUVER% - -:: Download Ninja -curl -k https://s3.amazonaws.com/ossci-windows/ninja_1.8.2.exe --output C:\Tools\ninja.exe -if errorlevel 1 exit /b 1 - -set "PATH=C:\Tools;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUVER%\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUVER%\libnvvp;%PATH%" -set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v%CUVER% -set NVTOOLSEXT_PATH=C:\Program Files\NVIDIA Corporation\NvToolsExt - -mkdir magma_cuda%CUVER_NODOT% -cd magma_cuda%CUVER_NODOT% - -if not exist magma ( - :: MAGMA 2.5.4 from http://icl.utk.edu/projectsfiles/magma/downloads/ with applied patches from our magma folder - git clone https://github.com/ptrblck/magma_win.git magma - if errorlevel 1 exit /b 1 -) else ( - rmdir /S /Q magma\build - rmdir /S /Q magma\install -) - -cd magma -mkdir build && cd build - -set GPU_TARGET=All -if "%CUVER_NODOT:~0,2%" == "12" ( - set CUDA_ARCH_LIST=-gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90 -) -if "%CUVER_NODOT%" == "118" ( - set CUDA_ARCH_LIST= -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_90,code=sm_90 -) - -set CC=cl.exe -set CXX=cl.exe - -cmake .. -DGPU_TARGET="%GPU_TARGET%" ^ - -DUSE_FORTRAN=0 ^ - -DCMAKE_CXX_FLAGS="/FS /Zf" ^ - -DCMAKE_BUILD_TYPE=%CONFIG% ^ - -DCMAKE_GENERATOR=Ninja ^ - -DCMAKE_INSTALL_PREFIX=..\install\ ^ - -DCUDA_ARCH_LIST="%CUDA_ARCH_LIST%" -if errorlevel 1 exit /b 1 - -cmake --build . --target install --config %CONFIG% -- -j%NUMBER_OF_PROCESSORS% -if errorlevel 1 exit /b 1 - -cd ..\..\.. - -:: Create -7z a magma_%MAGMA_VERSION%_cuda%CUVER_NODOT%_%CONFIG_LOWERCASE%.7z %cd%\magma_cuda%CUVER_NODOT%\magma\install\* - -rmdir /S /Q magma_cuda%CUVER_NODOT%\ -@endlocal