Skip to content

Commit

Permalink
v-0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nournadar committed Nov 27, 2022
1 parent 3f5cc55 commit cbd231e
Show file tree
Hide file tree
Showing 117 changed files with 3,249 additions and 287 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ cudacomplex
cudasingle
amdcpucomplex
amdcpusingle
*build/
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

18 changes: 8 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.19)
cmake_minimum_required(VERSION 3.20)

set(PROJECT_NAME TLRMVM)

Expand Down Expand Up @@ -35,7 +35,7 @@ set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
option(BUILD_CPU "Build TLR-MVM using cpp" ON)
option(BUILD_DPCPP "Build TLR-MVM on intel archs and use intel dpc++." OFF)
option(BUILD_CUDA "Build TLR-MVM on NVIDIA gpu and cuda." OFF) # using NVIDIA GPU
# option(BUILD_HIP "Build TLR-MVM on amd gpu and use hip." OFF) # using AMD GPU (AMD is under dev)
option(BUILD_HIP "Build TLR-MVM on amd gpu and use hip." OFF) # using AMD GPU (AMD is under dev)

#########################
# BLAS backend selection
Expand Down Expand Up @@ -190,18 +190,16 @@ endif() # BUILD_CUDA
# HIP library
#######################
if(BUILD_HIP)
list(APPEND CMAKE_PREFIX_PATH $ENV{HIP_PATH} $ENV{ROCM_PATH}
$ENV{HIP_PATH}/hip $ENV{HIP_PATH}/llvm/lib/clang/14.0.0/lib/linux)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result ")
enable_language(HIP)
find_package(HIP REQUIRED)
include(cmake/hiptlrmvm.cmake)
add_library(tlrmvmhiplib SHARED ${CPU_HEADERS} ${CPU_SRCS} ${HIP_HEADERS} ${HIP_SRCS})
find_package(hip REQUIRED)
find_package(hipblas REQUIRED)
set(TLRMVM_LIBS ${TLRMVM_LIBS} hip::device roc::hipblas)
# find_package(hipblas REQUIRED)
set(TLRMVM_LIBS ${TLRMVM_LIBS} hip::device hip::host hipblas)
target_include_directories(tlrmvmhiplib PUBLIC ${TLRMVM_INCS})
target_link_libraries(tlrmvmhiplib PUBLIC ${TLRMVM_LIBS})
AddCompileDefinitions(tlrmvmhiplib)
target_compile_definitions(tlrmvmhiplib PUBLIC -D__HIP_PLATFORM_HCC__=1) # for clion search ...
# target_compile_definitions(tlrmvmhiplib PUBLIC -D__HIP_PLATFORM_HCC__=1) # for clion search ...
target_compile_definitions(tlrmvmhiplib PUBLIC USE_HIP)
install(TARGETS tlrmvmhiplib DESTINATION lib)
endif() # BUILD_HIP
Expand All @@ -212,7 +210,7 @@ endif() # BUILD_HIP
#################
if(BUILD_PYTHON AND (BUILD_CUDA OR BUILD_HIP))
# now python is only available for CUDA and HIP build.
add_subdirectory(thirdparty/pybind11)
find_package(pybind11 REQUIRED)
add_subdirectory(pytlrmvm)
endif()

Expand Down
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2022, King Abdullah University of Science and Technology
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ Compile and install
## 4. Test
You also need to download the dataset to run the experiments.
dataset download url:
https://drive.google.com/drive/folders/1_DSyloFjlScXGTlA1_ybJnTne59tUpgR?usp=sharing
1. seismic redatuming dataset
https://zenodo.org/record/6582600
2. MAVIS AO system matrcies dataset
https://zenodo.org/record/7305622

after download, put it in a seperate folder and set `WORK_ROOT` to that folder.

Expand Down
3 changes: 3 additions & 0 deletions benchmark/cpp/bench_mvm_fp32.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
// All rights reserved.

#include <stdlib.h>
#include <math.h>
#include <memory.h>
Expand Down
3 changes: 3 additions & 0 deletions benchmark/cpp/bench_mvm_singlecomplex.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
// All rights reserved.

#include <stdlib.h>
#include <math.h>
#include <memory.h>
Expand Down
3 changes: 3 additions & 0 deletions benchmark/cuda/bench_mvm_cuda_fp32.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
// All rights reserved.

#include <stdlib.h>
#include <math.h>
#include <memory.h>
Expand Down
3 changes: 3 additions & 0 deletions benchmark/cuda/bench_mvm_cuda_singlecomplex.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
// All rights reserved.

#include <stdlib.h>
#include <math.h>
#include <memory.h>
Expand Down
3 changes: 3 additions & 0 deletions benchmark/hip/Bench_hip_constrank.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
// All rights reserved.

#include <iostream>
#include <unistd.h>
#include <memory.h>
Expand Down
5 changes: 5 additions & 0 deletions benchmark/hip/Bench_hip_tlrmvm.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

#
# @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
# All rights reserved.
#

./install/test/Bench_hip_constrank --M=9801 --N=9801 --threshold=0.001 \
--datafolder=$WORK_ROOT/compresseddata --nb=256 \
--problem=Mode4_Ordernormal_Mck_freqslice_100 --streams=10 --loopsize=200
21 changes: 21 additions & 0 deletions cmake/hiptlrmvm.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
include(${PROJECT_SOURCE_DIR}/cmake/tlrmvm.cmake)
set(HIP_SRCS)
set(HIP_HEADERS)

# Common
file(GLOB TMP ${PROJECT_SOURCE_DIR}/src/common/hip/*.cpp)
list(APPEND HIP_SRCS ${TMP})
file(GLOB TMP ${PROJECT_SOURCE_DIR}/src/common/hip/*.cu)
list(APPEND HIP_SRCS ${TMP})
file(GLOB TMP ${PROJECT_SOURCE_DIR}/src/common/hip/*.hpp)
list(APPEND HIP_HEADERS ${TMP})

# tlrmvm
file(GLOB TMP ${PROJECT_SOURCE_DIR}/src/tlrmvm/hip/*.cpp)
list(APPEND HIP_SRCS ${TMP})
file(GLOB TMP ${PROJECT_SOURCE_DIR}/src/tlrmvm/hip/*.cu)
list(APPEND HIP_SRCS ${TMP})
file(GLOB TMP ${PROJECT_SOURCE_DIR}/src/tlrmvm/hip/*.hpp)
list(APPEND HIP_HEADERS ${TMP})
file(GLOB TMP ${PROJECT_SOURCE_DIR}/src/tlrmvm/hip/*.cuh)
list(APPEND HIP_HEADERS ${TMP})
5 changes: 5 additions & 0 deletions install/install-x86-cuda.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/bash
#
# @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
# All rights reserved.
#

cmake -DCMAKE_CUDA_COMPILER:PATH=$(which nvcc) -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_C_COMPILER=$(which gcc) -DCMAKE_CXX_COMPILER=$(which g++) \
-DUSE_MPI=ON -DUSE_MKL=ON -DBUILD_CUDA=ON -DBUILD_TEST=ON -DBUILD_PYTHON=ON -DPYTHON_EXECUTABLE=$(which python)
#-DPython_ROOT_DIR=/home/hongy0a/miniconda3/envs/a100env
5 changes: 5 additions & 0 deletions install/install-x86.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#
# @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
# All rights reserved.
#

5 changes: 5 additions & 0 deletions install/spack-install-x86-cuda.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/bash
#
# @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
# All rights reserved.
#

git clone -c feature.manyFiles=true https://github.com/spack/spack.git
. $HOME/spack/share/spack/setup-env.sh
spack compiler find
Expand Down
5 changes: 5 additions & 0 deletions install/spack-install-x86.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/bash
#
# @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
# All rights reserved.
#

git clone -c feature.manyFiles=true https://github.com/spack/spack.git
. $HOME/spack/share/spack/setup-env.sh
spack compiler find
Expand Down
3 changes: 3 additions & 0 deletions pytlrmvm/Densemat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
# All rights reserved.

from os.path import join
from scipy.io import loadmat
import numpy as np
Expand Down
3 changes: 3 additions & 0 deletions pytlrmvm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def __bootstrap__():
spec.loader.exec_module(mod)
__bootstrap__()

# @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
# All rights reserved.

from ._wrapper import *
# from .tlrmvmtools import *
# from .tlrmat import *
Expand Down
3 changes: 3 additions & 0 deletions pytlrmvm/_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
# All rights reserved.

import TLRMVMpy as _cppimpl
import numpy as _np
from time import time as _time
Expand Down
27 changes: 0 additions & 27 deletions pytlrmvm/convertmat2npy.py

This file was deleted.

77 changes: 0 additions & 77 deletions pytlrmvm/generateseismicinput.py

This file was deleted.

3 changes: 3 additions & 0 deletions pytlrmvm/src/BatchTlrmvm.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
// All rights reserved.

//
// Created by Yuxi Hong on 12/03/2022.
//
Expand Down
3 changes: 3 additions & 0 deletions pytlrmvm/src/CommonWrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
// All rights reserved.

//
// Created by Yuxi Hong on 11/03/2022.
//
Expand Down
3 changes: 3 additions & 0 deletions pytlrmvm/src/Tlrmvm.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
// All rights reserved.

//
// Created by Yuxi Hong on 12/03/2022.
//
Expand Down
4 changes: 3 additions & 1 deletion pytlrmvm/src/Wrapper.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
// All rights reserved.

#include <pybind11/pybind11.h>
#include <pybind11/operators.h>
#include <pybind11/numpy.h>
Expand Down Expand Up @@ -157,7 +160,6 @@ PYBIND11_MODULE(TLRMVMpy, m) {
m.def("BatchUpdatexgpu_INT8_cf", &BatchUpdatex_INT8);
m.def("BatchUpdateygpu_INT8_cf", &BatchUpdatey_INT8);

addbatchtlrmvmgpufp16int8(m);

m.def("SetMaskmat", &SetMaskmat);
}
3 changes: 3 additions & 0 deletions pytlrmvm/src/wrapperdef.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
// All rights reserved.

//
// Created by Yuxi Hong on 12/03/2022.
//
Expand Down
3 changes: 3 additions & 0 deletions pytlrmvm/tlrmat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# @Copyright (c) 2022 King Abdullah University of Science and Technology (KAUST).
# All rights reserved.

import time
import pickle
import os
Expand Down
Loading

0 comments on commit cbd231e

Please sign in to comment.