Solve the problem of core dumped when using large-scale data in benchmark test

E.g :  when running test calse such as below in benchmark:
./strsm.goto 100000 100000 100000
From : 100000  To : 100000 Step = 100000 Side = L Uplo = U Trans = N Diag = U Loops = 1
   SIZE       Flops
 100000 :Segmentation fault (core dumped)
Because i+j*m has exceeded the maximum range of int
This commit is contained in:
江和松 2020-02-27 21:52:15 +08:00 committed by GitHub
parent ddcbed6690
commit 6cd87b5c39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -191,8 +191,8 @@ int main(int argc, char *argv[]){
for(j = 0; j < m; j++){
for(i = 0; i < m * COMPSIZE; i++){
a[i + j * m * COMPSIZE] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;
b[i + j * m * COMPSIZE] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;
a[(long)i + (long)j * (long)m * COMPSIZE] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;
b[(long)i + (long)j * (long)m * COMPSIZE] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;
}
}