hzhan0607 / cusp-library

Automatically exported from code.google.com/p/cusp-library
Apache License 2.0
0 stars 0 forks source link

CUSP crashes on 64bit Windows 7. #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Compile the following code on a 64bit Windows 7 and a 32bit Windows 7 by 
either Visual Studio or simply type "nvcc -arch=sm_20 test.cu" in cmd.
2. Running on 64bit, the code crashes at the host2device transfer while on 
32bit it runs fine.

I was using CUDA 4.0+CUSP 0.2.0. 

#include <stdlib.h>
#include <stdio.h>

#include <cusp/hyb_matrix.h>
#include "cuComplex.h"

void debug_complex()
{
    printf("debug_complex start\n");

    cusp::hyb_matrix<int, cusp::complex<double>, cusp::device_memory> device_matrix;

    int numeq = 3;
    int num_nonzero = 9;
    cusp::csr_matrix<int, cusp::complex<double>, cusp::host_memory> host_matrix(numeq, numeq, num_nonzero);

    int index = 0;
    for(int i=0; i<numeq; i++){
        host_matrix.row_offsets[i] = index;
        for(int j=0; j<numeq; j++){
            cuDoubleComplex comp = make_cuDoubleComplex(double(index), 0.0);
            host_matrix.column_indices[index] = j;
            host_matrix.values[index] = comp;
            index++;
        }
    }
    host_matrix.row_offsets[numeq] = index;

    // host(csr) -> device(hybrid)
    printf("host(csr) -> device(hybrid) start\n");
    device_matrix = host_matrix;
    printf("host(csr) -> device(hybrid) end\n");

    printf("debug_complex end\n");
}

int main(int argc, char **argv)
{
    debug_complex();

    return EXIT_SUCCESS;
}

Original issue reported on code.google.com by pwang...@gmail.com on 3 Nov 2011 at 2:20