From 1e757d7985e57353a7d1d596c51cc26886bcf956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E5=92=8C=E6=9D=BE?= <32100330+Darkness303@users.noreply.github.com> Date: Thu, 27 Feb 2020 20:58:55 +0800 Subject: [PATCH] Solve the problem of core dumped when using large-scale data in benchmark test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit E.g : when running test calse such as below in benchmark: ./sger.goto 100000 100000 100000 From : 100000 To : 100000 Step = 100000 Trans = 'N' Inc_x = 1 Inc_y = 1 Loops = 1 SIZE Flops 100000 : Segmentation fault (core dumped) Because i+j*m has exceeded the maximum range of int --- benchmark/ger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/ger.c b/benchmark/ger.c index a752a3c3e..c52018a1e 100644 --- a/benchmark/ger.c +++ b/benchmark/ger.c @@ -182,7 +182,7 @@ int main(int argc, char *argv[]){ for(j = 0; j < m; j++){ for(i = 0; i < n * COMPSIZE; i++){ - a[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; } }