Ok I feel as if the compiler thinks my host file is a device file (not sure what that means). At function in the host code (printf, fscanf, etc) I receive an error from the compiler:
calling a host function from a device/global function is only allowed in device emulation mode
At the beginning I receive:
error: identifier “main” is undefined
Here is first few lines of my host code
[codebox]#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <DiviMatrix.cu>
define CONVERGENCE 0.001
define MAXITERATIONS 50
define BLOCK_SIZE 16
main(){
float UpSum=0; /* UpMat sum used for Jacobi It */
float LowSum=0; /* LowMat sum used for Jacobi It */
unsigned int count_it=1; /* Number of iterations */
unsigned int j, i;
unsigned int count_conv=0; /* Count_conv argument if all converge */
unsigned int row, col; /* Number of Rows and Columns in A Matrix */
unsigned int placeholder, n; /* Placeholder - tells which rows to switch */
float SubMat /* Substitution Variable */
FILE *inFile;
/******************** Read in A and B Matrix ***********************/
inFile=fopen(“JacobiMatrix.dat”,“r”); /* Matrix File Extension */
if (inFile == NULL) /* If the program doesn’t exist */
{
printf(“\n The file was not successfully opened”);
printf(“\n Please Check that the file JacobiMatrix.dat exists. \n”);
exit(1);
}
fscanf(inFile,“%d”, &row);
fscanf(inFile,“%d”, &col);
float Mat[row][col]; /* A matrix */
float BMat[row]; /* B matrix */
float Inv_DiaMat [row][col]; /* Inverse Diagonal Matrix */
float UpMat [row][col]; /* Upper Matrix */
float LowMat [row][col]; /* Lower Matrix */
float Xold [col]; /* Vector of previous x values */
float XVec [col]; /* Vector of current x values */
for (i=0; i<row; i++)
{
for (j=0; j<col; j++)
{
fscanf(inFile,"%f", &Mat[i][j]);
}
}
for (i=0; i<row; i++)
fscanf(inFile,"%f",&BMat[i]);
fclose(inFile);
…
[/codebox]