including cutil.h file generating the errors. What could be the problem?
/* Includes, system */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
/* Includes, cuda */
#include <cublas.h>
#include <cuda_runtime.h>
#include <cutil.h>
/* Main /
int main(int argc, char* argv)
{
cublasStatus status;
float* h_A;
float* h_B;
float* h_C;
float* d_A = 0;
float* d_B = 0;
float* d_C = 0;
float alpha = 1.0f;
float beta = 0.0f;
int n2;
int i, size; /* Matrix size */
clock_t time_ffsum_start, time_ffsum_end ;
double looptime_ffsum ;
unsigned int timer = 0;
size = 25;
printf("**** CUBLAS SGEMM() ****\n");
do{
n2 = size * size;
/* Initialize CUBLAS */
status = cublasInit();
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! CUBLAS initialization error\n");
return EXIT_FAILURE;
}
/* Allocate host memory for the matrices */
h_A = (float*)malloc(n2 * sizeof(h_A[0]));
if (h_A == 0) {
fprintf (stderr, "!!!! host memory allocation error (A)\n");
return EXIT_FAILURE;
}
h_B = (float*)malloc(n2 * sizeof(h_B[0]));
if (h_B == 0) {
fprintf (stderr, "!!!! host memory allocation error (B)\n");
return EXIT_FAILURE;
}
h_C = (float*)malloc(n2 * sizeof(h_C[0]));
if (h_C == 0) {
fprintf (stderr, "!!!! host memory allocation error ©\n");
return EXIT_FAILURE;
}
/* Fill the matrices with test data */
for (i = 0; i < n2; i++) {
h_A[i] = 1.0 ;
h_B[i] = 1.0 ;
h_C[i] = 0.0 ;
}
/* Allocate device memory for the matrices */
status = cublasAlloc(n2, sizeof(d_A[0]), (void**)&d_A);
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! device memory allocation error (A)\n");
return EXIT_FAILURE;
}
status = cublasAlloc(n2, sizeof(d_B[0]), (void**)&d_B);
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! device memory allocation error (B)\n");
return EXIT_FAILURE;
}
status = cublasAlloc(n2, sizeof(d_C[0]), (void**)&d_C);
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! device memory allocation error ©\n");
return EXIT_FAILURE;
}
/* Initialize the device matrices with the host matrices */
status = cublasSetVector(n2, sizeof(h_A[0]), h_A, 1, d_A, 1);
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! device access error (write A)\n");
return EXIT_FAILURE;
}
status = cublasSetVector(n2, sizeof(h_B[0]), h_B, 1, d_B, 1);
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! device access error (write B)\n");
return EXIT_FAILURE;
}
status = cublasSetVector(n2, sizeof(h_C[0]), h_C, 1, d_C, 1);
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! device access error (write C)\n");
return EXIT_FAILURE;
}
/* Clear last error */
cublasGetError();
/* Performs operation using cublas */
time_ffsum_start = clock(); // begin timing ffsum loop
cublasSgemm('n', 'n', size, size, size, alpha, d_A, size, d_B, size, beta, d_C, size);
cudaThreadSynchronize();
time_ffsum_end = clock(); // end timing ffsum loop
status = cublasGetError();
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! kernel execution error.\n");
return EXIT_FAILURE;
}
/* Allocate host memory for reading back the result from device memory */
h_C = (float*)malloc(n2 * sizeof(h_C[0]));
if (h_C == 0) {
fprintf (stderr, "!!!! host memory allocation error ©\n");
return EXIT_FAILURE;
}
/* Read the result back */
status = cublasGetVector(n2, sizeof(h_C[0]), d_C, 1, h_C, 1);
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! device access error (read C)\n");
return EXIT_FAILURE;
}
/*Printing the result*/
looptime_ffsum = (double)(time_ffsum_end - time_ffsum_start);
printf("\t %f \n", looptime_ffsum );
/* for (i = 0; i < n2; i++) {
printf("%f \t", *(h_C + i));
}*/
/* Memory clean up */
free(h_A);
free(h_B);
free(h_C);
status = cublasFree(d_A);
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! memory free error (A)\n");
return EXIT_FAILURE;
}
status = cublasFree(d_B);
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! memory free error (B)\n");
return EXIT_FAILURE;
}
status = cublasFree(d_C);
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! memory free error ©\n");
return EXIT_FAILURE;
}
/* Shutdown */
status = cublasShutdown();
if (status != CUBLAS_STATUS_SUCCESS) {
fprintf (stderr, "!!!! shutdown error (A)\n");
return EXIT_FAILURE;
}
if (argc > 1) {
if (!strcmp(argv[1], "-noprompt") ||
!strcmp(argv[1], "-qatest") )
{
return EXIT_SUCCESS;
}
}
size = size + 25;
}while(size < 1000);
printf("\nPress ENTER to exit...\n");
getchar();
return EXIT_SUCCESS;
}
Output:
1>------ Rebuild All started: Project: CUBLASSGEMM, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project ‘CUBLASSGEMM’, configuration ‘Debug|Win32’
1>Compiling…
1>cublassgemm.c
1>c:\CUDA\common\inc\cutil.h(122) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(124) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(124) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(124) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(124) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(124) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(124) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(124) : error C2065: ‘false’ : undeclared identifier
1>c:\CUDA\common\inc\cutil.h(138) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(140) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(140) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(140) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(140) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(140) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(140) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(154) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(155) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(155) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(155) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(155) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(155) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(155) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(169) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(171) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(171) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(171) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(171) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(171) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(171) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(185) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(187) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(187) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(187) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(187) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(187) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(187) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(201) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(203) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(203) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(203) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(203) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(203) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(203) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(215) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(217) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(217) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(217) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(217) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(217) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(217) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(229) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(231) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(231) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(231) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(231) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(231) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(231) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(241) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(243) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(243) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(243) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(243) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(243) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(243) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(253) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(255) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(255) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(255) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(255) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(255) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(255) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(265) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(267) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(267) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(267) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(267) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(267) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(267) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(277) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(279) : error C2146: syntax error : missing ‘)’ before identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(279) : error C2081: ‘bool’ : name in formal parameter list illegal
1>c:\CUDA\common\inc\cutil.h(279) : error C2061: syntax error : identifier ‘verbose’
1>c:\CUDA\common\inc\cutil.h(279) : error C2059: syntax error : ‘;’
1>c:\CUDA\common\inc\cutil.h(279) : error C2513: '/global/ ’ : no variable declared before ‘=’
1>c:\CUDA\common\inc\cutil.h(279) : error C2059: syntax error : ‘)’
1>c:\CUDA\common\inc\cutil.h(293) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(306) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(320) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(336) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(352) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(367) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(379) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(391) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(404) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(416) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(428) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(440) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(461) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(475) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(489) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(503) : error C2143: syntax error : missing ‘{’ before ‘__stdcall’
1>c:\CUDA\common\inc\cutil.h(503) : fatal error C1003: error count exceeds 100; stopping compilation
1>Build log was saved at “file://c:\CUDA\projects\CUBLASSgemm\Debug\BuildLog.htm”
1>CUBLASSGEMM - 102 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Satakarni Bommuluri