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


命令示例:
 

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
...
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
mv magma_param.mod include/


____________________

1.1.2. 编译control/*.cpp


命令示例:

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

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


命令示例:
 

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
...
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


命令示例:
 

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
...
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


命令示例:
 

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
...
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


命令示例:
 

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
...
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


命令示例:
 

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
...
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


命令示例:
 

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
...
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


命令示例:
 

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
...
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

命令示例:
 

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

____________________

1.3. 生成 libmagma.so

命令示例:

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


____________________

1.4. 构建 testing


1.4.1 构建 testing/*.cpp

命令示例:
 

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
...
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


命令示例:
 

echo "===== static library testing/libtest.a"
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
ranlib testing/libtest.a
echo

____________________

1.4.3 构建 testing/lin/*.f

命令示例:

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

...

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

命令示例:
 

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


____________________

1.4.5. 构建 /testing/*.exe等

命令示例:

g++ -fPIC                       -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
-o testing/testing_zaxpy testing/testing_zaxpy.o \
-L./testing -ltest \
-L./lib -lmagma \
-L./testing/lin -llapacktest \
-L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart
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


...


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
g++ -fPIC                       -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
-o testing/testing_cgetrf_vbatched testing/testing_cgetrf_vbatched.o \
-L./testing -ltest \
-L./lib -lmagma \
-L./testing/lin -llapacktest \
-L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart
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 等

命令示例:

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
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

...

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等


命令示例:
 

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
...
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 等


命令示例:
 

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
...
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 等


命令示例:
 

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
...
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 等


命令示例:
 

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
...
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


命令示例:

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
...
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

命令示例:

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
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
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
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

命令示例:

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

____________________

2.3. 构建 libmagma_sparse.so

命令示例:
 

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
g++ -fPIC                       -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
-o sparse/testing/testing_zblas sparse/testing/testing_zblas.o \
-L./testing -ltest \
-L./lib -lmagma_sparse -lmagma \
-L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart

...

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
g++ -fPIC                       -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
-o sparse/testing/testing_smatrixcapcup sparse/testing/testing_smatrixcapcup.o \
-L./testing -ltest \
-L./lib -lmagma_sparse -lmagma \
-L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart

____________________

2.4. 构建 sparse/testing/ *.exe

命令示例:

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
g++ -fPIC                       -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
-o sparse/testing/testing_zblas sparse/testing/testing_zblas.o \
-L./testing -ltest \
-L./lib -lmagma_sparse -lmagma \
-L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart

...

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
g++ -fPIC                       -fopenmp -Wl,-rpath,/home/hipper/make_magma_ex/magma/lib \
-o sparse/testing/testing_smatrixcapcup sparse/testing/testing_smatrixcapcup.o \
-L./testing -ltest \
-L./lib -lmagma_sparse -lmagma \
-L/opt/OpenBLAS/lib -L/usr/local/cuda/lib64 -lopenblas -lcublas -lcusparse -lcudart -lcudadevrt -lcublas -lcudart


 

你可能感兴趣的:(java,人工智能,linux)