I am a newbie to scientific computing and C programming. I made some code using MAGMA FUNCTIONS, but after running the tests I realized that my GPU (1050 ti) is beaten in many routines by the CPU function. I want two create multiple versions of the code that use the CPU or HYBRID_MAGMA routines depending of the needs (no GPU, double type, float type, slow double GPU, fast double GPU). For example, I would like to have a program that uses, a LAPACK/CPU for dgemm, MAGMA dsgeqrsv and CUBLAS lvl 2 routines function. I have been experiencing troubles combining functions from LAPACK/CPU and MAGMA/CUBLAS. I am currently programming in C/Linux, compiling with gcc:
Code: Select all
% MAGMA 2.4.0 compiled for CUDA capability >= 3.0, 64-bit magma_int_t, 64-bit pointer.
% CUDA runtime 9010, driver 9010. OpenMP threads 8. MKL 2018.0.3, MKL threads 4.
% device 0: GeForce GTX 1050, 1493.0 MHz clock, 4042.4 MiB memory, capability 6.1
Code: Select all
make
gcc main.c -o hit_run -Wall -lm -no-pie -DADD_ -I/usr/local/magma/include -I/usr/local/magma/sparse/include -I/usr/lib/cuda/include -L/usr/local/magma/lib -lmagma_sparse -lmagma -L/usr/lib/cuda/lib64 -lcublas -lcudart -lcusparse -L/usr/lib/x86_64-linux-gnu/openblas/lib -lopenblas ./lpsolve/liblpsolve55.a -ldl -I/opt/intel/mkl/include -L /opt/intel/mkl/lib/64 -L /opt/intel/mkl/lib/64 -lmkl_intel_lp64 -lmkl_sequential -lmkl_core
In file included from main.c:3:0:
matrix/matrix_read.c: In function ‘count’:
matrix/matrix_read.c:70:8: warning: implicit declaration of function ‘count_lines’ [-Wimplicit-function-declaration]
ME = count_lines(b_eq);
^~~~~~~~~~~
matrix/matrix_read.c:79:13: warning: implicit declaration of function ‘count_vars’; did you mean ‘count’? [-Wimplicit-function-declaration]
N = count_vars(a_eq);
^~~~~~~~~~
count
In file included from /usr/local/magma/include/magma_lapack.h:14:0,
from matrix/matrix_operations_magma.c:13,
from main.c:7:
/usr/local/magma/include/magma_zlapack.h: At top level:
/usr/local/magma/include/magma_zlapack.h:46:42: error: conflicting types for ‘zrot_’
#define blasf77_zrot FORTRAN_NAME( zrot, ZROT )
^
/usr/local/magma/include/magma_mangling.h:26:47: note: in definition of macro ‘FORTRAN_NAME’
#define FORTRAN_NAME(lcname, UCNAME) lcname##_
^~~~~~
/usr/local/magma/include/magma_zlapack.h:298:6: note: in expansion of macro ‘blasf77_zrot’
void blasf77_zrot( const magma_int_t *n,
^~~~~~~~~~~~
In file included from /opt/intel/mkl/include/mkl.h:33:0,
from matrix/matrix_read.c:10,
from main.c:3:
/opt/intel/mkl/include/mkl_lapack.h:30372:6: note: previous declaration of ‘zrot_’ was here
void zrot_( const MKL_INT* n, MKL_Complex16* cx, const MKL_INT* incx,
^~~~~
In file included from /usr/local/magma/include/magma_lapack.h:14:0,
from matrix/matrix_operations_magma.c:13,
from main.c:7:
/usr/local/magma/include/magma_zlapack.h:62:42: error: conflicting types for ‘zbdsqr_’
#define lapackf77_zbdsqr FORTRAN_NAME( zbdsqr, ZBDSQR )
^
/usr/local/magma/include/magma_mangling.h:26:47: note: in definition of macro ‘FORTRAN_NAME’
#define FORTRAN_NAME(lcname, UCNAME) lcname##_
Code: Select all
/*--------- Algebra libraries--------- */
#include "mkl.h"
#include "mkl_service.h"
#include "i_malloc.h"
/*-------------------------------------- */
Code: Select all
/*--------- Algebra libraries--------- */
#include <cuda_runtime.h>
#include <cuda.h>
#include "cublas_v2.h"
#include "magma_v2.h"
#include "magma_lapack.h"
cblas_dgemm(CblasColMajor, CblasTrans, CblasNoTrans,
m, n, k, alpha, E, k ,E, k, beta, AAT, n);
/*-------------------------------------- */
Thanks for reading, I would really appreciate some help!