From 2d06de7748488b5e3c5de61c6ca9cf6e173f5268 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 21:16:28 +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: ./chemv.goto 100000 100000 100000 From : 100000 To : 100000 Step = 100000 Uplo = 'L' Inc_x = 1 Inc_y = 1 Loops = 1 SIZE Flops 100000x100000 : Segmentation fault (core dumped) Because i+j*m has exceeded the maximum range of int --- benchmark/hemv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmark/hemv.c b/benchmark/hemv.c index 05028e3cf..b6ff512ce 100644 --- a/benchmark/hemv.c +++ b/benchmark/hemv.c @@ -167,7 +167,7 @@ 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; + a[(long)i + (long)j * (long)m * COMPSIZE] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5; } }