1#!/usr/bin/octave --silent 2 3nfrom = 128 ; 4nto = 2048; 5nstep = 128; 6loops = 1; 7 8 9arg_list = argv(); 10for i = 1:nargin 11 12 switch(i) 13 case 1 14 nfrom = str2num(arg_list{i}); 15 case 2 16 nto = str2num(arg_list{i}); 17 case 3 18 nstep = str2num(arg_list{i}); 19 case 4 20 loops = str2num(arg_list{i}); 21 22 endswitch 23 24endfor 25 26p = getenv("OPENBLAS_LOOPS"); 27if p 28 loops = str2num(p); 29endif 30 31printf("From %d To %d Step=%d Loops=%d\n",nfrom, nto, nstep, loops); 32printf(" SIZE FLOPS TIME\n"); 33 34n = nfrom; 35while n <= nto 36 37 A = single(rand(n,n)) + single(rand(n,n)) * 1i; 38 B = single(rand(n,1)) + single(rand(n,1)) * 1i; 39 start = clock(); 40 41 l=0; 42 while l < loops 43 44 C = A * B; 45 l = l + 1; 46 47 endwhile 48 49 timeg = etime(clock(), start); 50 mflops = ( 4.0 * 2.0*n*n *loops ) / ( timeg * 1.0e6 ); 51 52 st1 = sprintf("%dx%d : ", n,n); 53 printf("%20s %10.2f MFlops %10.6f sec\n", st1, mflops, timeg); 54 n = n + nstep; 55 56endwhile 57