Problem with matrix multiplication (in Cula R12)

General discussion for CULA. Use this forum for questions, examples, feedback, and feature requests.

Problem with matrix multiplication (in Cula R12)

Postby marc119 » Fri Oct 21, 2011 7:37 am

I have a some Problem mit Cula matrix Multiplikation, I am using Visual Studio 2010 Ultimate, Cula r12 Basic edition.

This is my code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <ostream>
#include <cula.h>
#include <math.h>
#include <culablas.h>
#include <culapack.h>

using namespace std;

void checkStatus(culaStatus status)
{
char buf[80];

if(!status)
return;

culaGetErrorInfoString(status, culaGetErrorInfo(), buf, sizeof(buf));
printf("%s\n", buf);

culaShutdown();
exit(EXIT_FAILURE);
}


void culaFloatExample()
{

int N=8;
int M=8;
int K=N;
int i;

culaStatus status;

printf("Initializing CULA\n");
status = culaInitialize();
checkStatus(status);

culaFloat* Matrix_A = NULL;
culaFloat* Matrix_B = NULL;
culaFloat* Matrix_R = NULL;

printf("Allocating Matrices\n");
Matrix_A = (culaFloat*)malloc(M*N*sizeof(culaFloat));
Matrix_B = (culaFloat*)malloc(M*N*sizeof(culaFloat));
Matrix_R = (culaFloat*)malloc(M*N*sizeof(culaFloat));

for (i=0; i<M*N; i++) Matrix_A[i]=1.0;
for (i=0; i<M*N; i++) Matrix_B[i]=3.0;
for (i=0; i<M*N; i++) Matrix_R[i]=1.0;

printf("Calling culaSgemm\n");


status = culaSgemm('N', 'N', M, N, K, 1, Matrix_A, 8, Matrix_B, 8, 1, Matrix_R, 32);

checkStatus(status);

printf("The Multiply result is:\n");
for (i=0; i<32; i++) printf("Matrix_R[%d]: %.1f\n",i, Matrix_R[i]);


printf("Shutting down CULA\n\n");
culaShutdown();

free(Matrix_A);
free(Matrix_B);
free(Matrix_R);

cout << status;

}

int MeetsMinimumCulaRequirements()
{
int cudaMinimumVersion = culaGetCudaMinimumVersion();
int cudaRuntimeVersion = culaGetCudaRuntimeVersion();
int cudaDriverVersion = culaGetCudaDriverVersion();
int cublasMinimumVersion = culaGetCublasMinimumVersion();
int cublasRuntimeVersion = culaGetCublasRuntimeVersion();

if(cudaRuntimeVersion < cudaMinimumVersion)
{
printf("CUDA runtime version is insufficient; version %d or greater is required\n", cudaMinimumVersion);
return 0;
}

if(cudaDriverVersion < cudaMinimumVersion)
{
printf("CUDA driver version is insufficient; version %d or greater is required\n", cudaMinimumVersion);
return 0;
}

if(cublasRuntimeVersion < cublasMinimumVersion)
{
printf("CUBLAS runtime version is insufficient; version %d or greater is required\n", cublasMinimumVersion);
return 0;
}

return 1;
}



int main(int argc, _TCHAR* argv[])
{

MeetsMinimumCulaRequirements();
culaFloatExample();

return EXIT_SUCCESS;

}


I get the following error:

Error 1 error C2719: 'alpha': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 74 1 MatrixProduct
Error 3 error C2719: 'alpha': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 75 1 MatrixProduct
Error 5 error C2719: 'alpha': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 76 1 MatrixProduct
Error 7 error C2719: 'alpha': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 77 1 MatrixProduct
Error 9 error C2719: 'alpha': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 78 1 MatrixProduct
Error 10 error C2719: 'alpha': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 80 1 MatrixProduct
Error 12 error C2719: 'alpha': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 81 1 MatrixProduct
Error 14 error C2719: 'alpha': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 82 1 MatrixProduct
Error 16 error C2719: 'alpha': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 83 1 MatrixProduct
Error 17 error C2719: 'alpha': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 84 1 MatrixProduct
Error 2 error C2719: 'beta': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 74 1 MatrixProduct
Error 4 error C2719: 'beta': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 75 1 MatrixProduct
Error 6 error C2719: 'beta': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 76 1 MatrixProduct
Error 8 error C2719: 'beta': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 77 1 MatrixProduct
Error 11 error C2719: 'beta': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 80 1 MatrixProduct
Error 13 error C2719: 'beta': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 81 1 MatrixProduct
Error 15 error C2719: 'beta': Formeller Parameter mit __declspec(align('16')) wird nicht ausgerichtet c:\programme\cula\r12\include\culablas.h 82 1 MatrixProduct

I do not understand why he goes on this line? for example for the first error:

culaStatus culaZgemm(char transa, char transb, int m, int n, int k, culaDoubleComplex alpha, culaDoubleComplex* a, int lda, culaDoubleComplex* b, int ldb, culaDoubleComplex beta, culaDoubleComplex* c, int ldc);

I have not used Zgemm and also I have a basic version of Cula r12

Can someone Help me?
marc119
 
Posts: 3
Joined: Mon Sep 20, 2010 7:16 am

Re: Problem with matrix multiplication (in Cula R12)

Postby john » Fri Oct 21, 2011 10:25 am

Are you compiling for 32-bit?
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: Problem with matrix multiplication (in Cula R12)

Postby marc119 » Tue Oct 25, 2011 9:21 am

Yes.
marc119
 
Posts: 3
Joined: Mon Sep 20, 2010 7:16 am

Re: Problem with matrix multiplication (in Cula R12)

Postby john » Tue Nov 01, 2011 5:19 am

Try adding
#define CULA_USE_CUDA_COMPLEX prior to including any CULA headers. This tends to get around alignment messages on 32-bit windows builds.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: Problem with matrix multiplication (in Cula R12)

Postby marc119 » Fri Nov 04, 2011 8:30 am

I have tried, it is coming the same error with or without this line
marc119
 
Posts: 3
Joined: Mon Sep 20, 2010 7:16 am

Re: Problem with matrix multiplication (in Cula R12)

Postby john » Fri Nov 04, 2011 10:12 am

I've just tried your code myself and it compiles correctly when the top of the file reads:

Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include <ostream>
#define CULA_USE_CUDA_COMPLEX
#include <cula.h>
#include <math.h>
#include <culablas.h>
#include <culapack.h>


When I remove that #define I receive the same error you do.
john
Administrator
 
Posts: 587
Joined: Thu Jul 23, 2009 2:31 pm

Re: Problem with matrix multiplication (in Cula R12)

Postby cs10b026 » Mon Feb 17, 2014 8:46 pm

Hi,

I am following the same code for multiplying two matrices but I am getting the following error:
Argument 13 is invalid (see the Reference Manual for more information)

Can you help me with this?

Here is my code.

1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 #include <cula_lapack_device.h>
6
7 #include <cuda_runtime.h>
8 #ifdef _MSC_VER
9 # pragma comment(lib, "cudart.lib")
10 #endif
11 void checkStatus(culaStatus status)
12 {
13 char buf[256];
14
15 if(!status)
16 return;
17
18 culaGetErrorInfoString(status, culaGetErrorInfo(), buf, sizeof(buf));
19 printf("%s\n", buf);
20
21 culaShutdown();
22 exit(EXIT_FAILURE);
23 }
24
25
26 int main()
27 {
28 culaStatus status;
29 culaFloat* a = NULL;
30 culaFloat* b = NULL;
31 culaFloat* c = NULL;
32
33 a = (culaFloat*)malloc(9 * sizeof(culaFloat));
34
35 checkStatus(status);
36
37 b = (culaFloat*)malloc(9 * sizeof(culaFloat));
38
39 checkStatus(status);
40
41 c = (culaFloat*)malloc(9 * sizeof(culaFloat));
42
43 int i;
44
45 for(i = 0; i < 9; i++)
46 a[i] = b[i] = c[i] = 1;
47
48 status = culaInitialize();
49
50 checkStatus(status);
51
52 status = culaSgemm('N', 'N', 3, 3, 3, 1, a, 3, b, 3, 1, c, 32);
53
54 checkStatus(status);
55
56 for(i = 0; i < 9; i++)
57 printf("%f\n", c[i]);
58
59 checkStatus(status);
60
61 return 0;
62 }
cs10b026
 
Posts: 4
Joined: Mon Feb 17, 2014 12:43 am


Return to General CULA Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron