• magma build system 分析 —— 第04记 make -n 的记录


    零, 总体步骤

    0.1. dense 阶段

    先生成dense 函数相关的 *.o

    生成 dense 的 .so

    生成 dense 的 .a

    生成 dense 的 testing

    0.2. sparse 阶段

    类似的步骤生成sparse的内容;


    一, build dense libmagma.so libmagma.a testing/*.exe

    1.1. 编译 dense 的 *.o

    1.1.1 构建 control/*.F90


    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o control/magma_f77.o control/magma_f77.cpp
    2. ...
    3. gfortran -g -fPIC -DNDEBUG -DADD_ -Wall -Wno-unused-dummy-argument -x f95-cpp-input -I/usr/local/cuda/include -I./include -I./testing -I./control -Dmagma_devptr_t="integer(kind=8)" -c -o control/magma_param.o control/magma_param.F90
    4. mv magma_param.mod include/


    ____________________

    1.1.2. 编译control/*.cpp


    命令示例:

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o control/abs.o control/abs.cpp
    2. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o control/magmablas_zf77.o control/magmablas_zf77.cpp


    ____________________


    1.1.3. 编译 src/*.cpp


    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o src/cblas_z.o src/cblas_z.cpp
    2. ...
    3. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o src/zpotrf_panel_native.o src/zpotrf_panel_native.cpp


    ____________________


    1.1.4. 编译 interface_cuda/*.cpp


    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o interface_cuda/alloc.o interface_cuda/alloc.cpp
    2. ...
    3. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o interface_cuda/interface_v1.o interface_cuda/interface_v1.cpp


    ____________________


    1.1.5. 编译 magmablas/*.cu *.cpp


    命令示例:
     

    1. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o magmablas/zaxpycp.o magmablas/zaxpycp.cu
    2. ...
    3. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o magmablas/zposv_irgmres_kernels.o magmablas/zposv_irgmres_kernels.cu


    ____________________


    1.1.6. 编译control/*.cpp


    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o control/magma_sauxiliary.o control/magma_sauxiliary.cpp
    2. ...
    3. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o control/cprint.o control/cprint.cpp

    ____________________


    1.1.7. 编译 src/*.cpp


    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o src/cblas_s.o src/cblas_s.cpp
    2. ...
    3. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o src/cpotrf_panel_native.o src/cpotrf_panel_native.cpp

    ____________________


    1.1.8. 编译 interface_cuda/*.cpp


    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o interface_cuda/blas_s_v1.o interface_cuda/blas_s_v1.cpp
    2. ...
    3. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o interface_cuda/blas_c_v2.o interface_cuda/blas_c_v2.cpp

    ____________________

    1.1.9. 编译另一些 magmablas/*.cpp  *.cu


    命令示例:
     

    1. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o magmablas/saxpycp.o magmablas/saxpycp.cu
    2. ...
    3. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -c -o magmablas/sposv_irgmres_kernels.o magmablas/sposv_irgmres_kernels.cu

    ____________________

    1.2. 生成 libmagma.a

    命令示例:
     

    1. echo "===== static library lib/libmagma.a"
    2. ar cr lib/libmagma.a 等 control/*.o src/*.o magmablas/*.o 等等
    3. ranlib lib/libmagma.a

    ____________________

    1.3. 生成 libmagma.so

    命令示例:

    1. echo
    2. echo "===== shared library LLL:: lib/libmagma.so"
    3. g++ -fPIC -fopenmp -shared -o lib/libmagma.so \
    4. control/*.o src/*.o interface_cuda/*.o magmablas/*.o src/*.o \
    5. -L./lib -L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart
    6. echo


    ____________________

    1.4. 构建 testing


    1.4.1 构建 testing/*.cpp

    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./testing -c -o testing/testing_zaxpy.o testing/testing_zaxpy.cpp
    2. ...
    3. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./testing -c -o testing/magma_cgesvd_check.o testing/magma_cgesvd_check.cpp

    1.4.2 构建 testing/libtest.a


    命令示例:
     

    1. echo "===== static library testing/libtest.a"
    2. ar cr testing/libtest.a testing/magma_util.o testing/magma_zutil.o testing/magma_zgesvd_check.o testing/magma_generate.o testing/magma_cutil.o testing/magma_dutil.o testing/magma_sutil.o testing/magma_sgesvd_check.o testing/magma_dgesvd_check.o testing/magma_cgesvd_check.o
    3. ranlib testing/libtest.a
    4. echo

    ____________________

    1.4.3 构建 testing/lin/*.f

    命令示例:

    1. gfortran -g -fPIC -DNDEBUG -DADD_ -Wall -Wno-unused-dummy-argument -c -o testing/lin/zbdt01.o testing/lin/zbdt01.f
    2. ...
    3. gfortran -g -fPIC -DNDEBUG -DADD_ -Wall -Wno-unused-dummy-argument -c -o testing/lin/sstt21.o testing/lin/sstt21.f


    ____________________


    1.4.4. #构建 liblapacktest.a

    命令示例:
     

    1. echo "===== static library testing/lin/liblapacktest.a"
    2. ar cr testing/lin/*.o 等
    3. ranlib testing/lin/liblapacktest.a
    4. echo


    ____________________

    1.4.5. 构建 /testing/*.exe等

    命令示例:

    1. g++ -fPIC -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
    2. -o testing/testing_zaxpy testing/testing_zaxpy.o \
    3. -L./testing -ltest \
    4. -L./lib -lmagma \
    5. -L./testing/lin -llapacktest \
    6. -L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart
    7. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./testing -c -o testing/testing_zgemm.o testing/testing_zgemm.cpp
    8. ...
    9. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./testing -c -o testing/testing_cgetrf_vbatched.o testing/testing_cgetrf_vbatched.cpp
    10. g++ -fPIC -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
    11. -o testing/testing_cgetrf_vbatched testing/testing_cgetrf_vbatched.o \
    12. -L./testing -ltest \
    13. -L./lib -lmagma \
    14. -L./testing/lin -llapacktest \
    15. -L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart
    16. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/blas/magma_z_blaswrapper.o sparse/blas/magma_z_blaswrapper.cpp


    ____________________


    =================================================


    二, build sparse

    2.1. 生成 sparse 的 /*.o

    2.1.1 构建 sparse/blas/*cpp  sparse/blas/*.cu 等

    命令示例:

    1. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/blas/zbajac_csr.o sparse/blas/zbajac_csr.cu
    2. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/blas/zilu.o sparse/blas/zilu.cpp
    3. ...
    4. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -Xptxas -dlcm=cg -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/blas/zgecscsyncfreetrsm.o sparse/blas/zgecscsyncfreetrsm.cu

    ____________________


    2.1.2. 构建 saprse/control/*.cpp等


    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/control/error.o sparse/control/error.cpp
    2. ...
    3. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/control/magma_zparict_tools.o sparse/control/magma_zparict_tools.cpp


    ____________________


    2.1.3. 构建 sparse/src/*.cpp 等


    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/src/zcg.o sparse/src/zcg.cpp
    2. ...
    3. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/src/zjacobidomainoverlap.o sparse/src/zjacobidomainoverlap.cpp

    ____________________

    2.1.4. 构建 sparse/*.cpp  sparse/*.cu 等


    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/blas/magma_c_blaswrapper.o sparse/blas/magma_c_blaswrapper.cpp
    2. ...
    3. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -Xptxas -dlcm=cg -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/blas/sgecscsyncfreetrsm.o sparse/blas/sgecscsyncfreetrsm.cu

    ____________________


    2.1.5. 构建 saprse/control/*.cpp 等


    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/control/magma_sdomainoverlap.o sparse/control/magma_sdomainoverlap.cpp
    2. ...
    3. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/control/magma_cparict_tools.o sparse/control/magma_cparict_tools.cpp

    ___________

    2.1.6. 构建 sparse/src/*.cpp


    命令示例:

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/src/scg.o sparse/src/scg.cpp
    2. ...
    3. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -c -o sparse/src/cjacobidomainoverlap.o sparse/src/cjacobidomainoverlap.cpp

    命令示例:

    1. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -Isparse/include -dc -o sparse/blas/magma_dsampleselect_core.o sparse/blas/magma_dsampleselect_core.cu
    2. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -Isparse/include -dc -o sparse/blas/magma_sampleselect.o sparse/blas/magma_sampleselect.cu
    3. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -Isparse/include -dc -o sparse/blas/magma_ssampleselect_core.o sparse/blas/magma_ssampleselect_core.cu
    4. nvcc -O3 -DNDEBUG -DADD_ -Xcompiler "-fPIC" -std=c++11 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_80,code=compute_80 -I/usr/local/cuda/include -I./include -I./testing -I./control -I./magmablas -I./sparse/include -I./sparse/control -dlink -Isparse/include -o sparse/blas/dynamic.link.o sparse/blas/magma_dsampleselect_core.o sparse/blas/magma_sampleselect.o sparse/blas/magma_ssampleselect_core.o


    ____________________

    2.2. 构建 libmagma_sparse.a

    命令示例:

    1. echo "===== static library lib/libmagma_sparse.a"
    2. ar cr lib/libmagma_sparse.a sparse/blas/*.o sparse/control/*.o sparse/src/*.o
    3. ranlib lib/libmagma_sparse.a
    4. echo

    ____________________

    2.3. 构建 libmagma_sparse.so

    命令示例:
     

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./sparse/include -I./sparse/control -I./testing -c -o sparse/testing/testing_zblas.o sparse/testing/testing_zblas.cpp
    2. g++ -fPIC -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
    3. -o sparse/testing/testing_zblas sparse/testing/testing_zblas.o \
    4. -L./testing -ltest \
    5. -L./lib -lmagma_sparse -lmagma \
    6. -L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart
    7. ...
    8. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./sparse/include -I./sparse/control -I./testing -c -o sparse/testing/testing_smatrixcapcup.o sparse/testing/testing_smatrixcapcup.cpp
    9. g++ -fPIC -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
    10. -o sparse/testing/testing_smatrixcapcup sparse/testing/testing_smatrixcapcup.o \
    11. -L./testing -ltest \
    12. -L./lib -lmagma_sparse -lmagma \
    13. -L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart

    ____________________

    2.4. 构建 sparse/testing/ *.exe

    命令示例:

    1. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./sparse/include -I./sparse/control -I./testing -c -o sparse/testing/testing_zblas.o sparse/testing/testing_zblas.cpp
    2. g++ -fPIC -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
    3. -o sparse/testing/testing_zblas sparse/testing/testing_zblas.o \
    4. -L./testing -ltest \
    5. -L./lib -lmagma_sparse -lmagma \
    6. -L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart
    7. ...
    8. g++ -g -fPIC -DNDEBUG -DADD_ -Wall -fopenmp -std=c++11 -I/usr/local/cuda/include -I./include -I./testing -I./sparse/include -I./sparse/control -I./testing -c -o sparse/testing/testing_smatrixcapcup.o sparse/testing/testing_smatrixcapcup.cpp
    9. g++ -fPIC -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
    10. -o sparse/testing/testing_smatrixcapcup sparse/testing/testing_smatrixcapcup.o \
    11. -L./testing -ltest \
    12. -L./lib -lmagma_sparse -lmagma \
    13. -L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart


     

  • 相关阅读:
    面向对象-Python
    Redis事务和锁机制
    用于物体识别和跟踪的下游任务自监督学习-2-背景
    【Python】操作符梅花号*、乘号*的用法汇总与小结
    jsx代码如何变成dom
    【三维目标检测】VoteNet(一)
    解析富有童趣的人工智能早教机器人
    大数据Eureka的使用以及应用场景详解
    Spring MVC(上)
    Servlet
  • 原文地址:https://blog.csdn.net/eloudy/article/details/134461236