Skip to content

Build fails: wrong types in HPCCG.c #6

@jamesavery

Description

@jamesavery

The old branch fails to build from a fresh clone for a number of reasons. One is some type errors in HPCCG.c. They are fixed with the following patch:

diff --git a/HPCCG_preprocessed/HPCCG.c b/HPCCG_preprocessed/HPCCG.c
index db41a9e..d075c1e 100644
--- a/HPCCG_preprocessed/HPCCG.c
+++ b/HPCCG_preprocessed/HPCCG.c
@@ -104,14 +104,14 @@ void HPC_sparsemv( HPC_Sparse_Matrix *A, double* x, double* y)
 }
 
 void dump_matlab_matrix(HPC_Sparse_Matrix *A, int rank) {
-  double nrow = A->local_nrow;
-  double start_row = nrow*rank; // Each processor gets a section of a chimney stack domain
+  int nrow = A->local_nrow;
+  int start_row = nrow*rank; // Each processor gets a section of a chimney stack domain
 
   printf("===== MATRIX DUMP ======\n");
   for (int i=0; i< nrow; i++) {
     int cur_nnz = A->nnz_in_row[i];
     for (int j=0; j< cur_nnz; j++) {
-      printf(" %f %d %22.16e,",start_row+i+1,A->ptr_to_inds_in_row[i][j]+1,A->ptr_to_vals_in_row[i][j]);
+      printf(" %d %d %22.16e,",start_row+i+1,A->ptr_to_inds_in_row[i][j]+1,A->ptr_to_vals_in_row[i][j]);
     }
     printf("\n");
   }
@@ -203,14 +203,14 @@ int main(int argc, char *argv[])
 
   int local_nrow = nx*ny*nz; // This is the size of our subblock
 
-  double max_nnz = 27;
+  long long max_nnz = 27;
   int local_nnz = max_nnz*local_nrow; // Approximately 27 nonzeros per row (except for boundary nodes)
 
   int total_nrow = local_nrow*size; // Total number of grid points in mesh
   long long total_nnz = max_nnz* (long long) total_nrow; // Approximately 27 nonzeros per row (except for boundary nodes)
 
-  double start_row = local_nrow*rank; // Each processor gets a section of a chimney stack domain
-  double stop_row = start_row+local_nrow-1;
+  int start_row = local_nrow*rank; // Each processor gets a section of a chimney stack domain
+  int stop_row = start_row+local_nrow-1;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions