testing_dgemm output

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Post Reply
ritadia
Posts: 7
Joined: Thu Jul 09, 2015 8:39 am

testing_dgemm output

Post by ritadia » Wed Jul 15, 2015 3:31 am

Hi, i am a beginner with Magma
can somebody please explain me the output of testing_dgemm ? if i am running 4 Gpu , the results shown in (Magma Gflops) are for one Gpu or for the four?? and the Cpu Gflops are for all the MKL Cpu or just for one?
Thank you in advance

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: testing_dgemm output

Post by mgates3 » Wed Jul 15, 2015 10:41 pm

GPU results are for 1 GPU.
CPU results are for all the CPU cores, or as many as you specified via $OMP_NUM_THREADS, $MKL_NUM_THREADS, or other setting, depending on your BLAS library.

As an example, this achieves about 1009 Gflop/s with cuBLAS gemm on 1 K20 GPU, regardless of how many GPUs are installed, and 153 Gflop/s on 12 cores (Westmere X5680).

Code: Select all

animal magma-trunk/testing> numactl --interleave=all ./testing_dgemm --range 1000:4000:1000 -l
% MAGMA 1.6.2 svn compiled for CUDA capability >= 3.5, 64-bit magma_int_t, 64-bit pointer.
% CUDA runtime 7000, driver 7000. OpenMP threads 12. MKL 11.2.3, MKL threads 12. 
% device 0: Tesla K20c, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
% Wed Jul 15 22:45:07 2015
% Usage: ./testing_dgemm [options] [-h|--help]

% If running lapack (option --lapack), MAGMA and cuBLAS error are both computed
% relative to CPU BLAS result. Else, MAGMA error is computed relative to cuBLAS result.

% transA = No transpose, transB = No transpose
%   M     N     K   MAGMA Gflop/s (ms)  cuBLAS Gflop/s (ms)   CPU Gflop/s (ms)  MAGMA error  cuBLAS error
%========================================================================================================
 1000  1000  1000    464.05 (   4.31)     911.61 (   2.19)     62.24 (  32.13)    8.23e-16     8.25e-16   ok
 2000  2000  2000    524.39 (  30.51)     956.48 (  16.73)    147.98 ( 108.12)    1.12e-15     1.12e-15   ok
 3000  3000  3000    553.08 (  97.64)    1006.84 (  53.63)    151.00 ( 357.61)    1.55e-15     1.55e-15   ok
 4000  4000  4000    545.14 ( 234.80)    1008.82 ( 126.88)    152.68 ( 838.34)    1.57e-15     1.57e-15   ok
Changing the number of OpenMP threads (which MKL inherits) changes the CPU performance. With 4 threads, it gets 54 Gflop/s, about a third of 12 threads result above.

Code: Select all

animal magma-trunk/testing> setenv OMP_NUM_THREADS 4
animal magma-trunk/testing> numactl --interleave=all ./testing_dgemm --range 1000:4000:1000 -l
% MAGMA 1.6.2 svn compiled for CUDA capability >= 3.5, 64-bit magma_int_t, 64-bit pointer.
% CUDA runtime 7000, driver 7000. OpenMP threads 4. MKL 11.2.3, MKL threads 4. 
% device 0: Tesla K20c, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
% Wed Jul 15 22:52:12 2015
% Usage: ./testing_dgemm [options] [-h|--help]

% If running lapack (option --lapack), MAGMA and cuBLAS error are both computed
% relative to CPU BLAS result. Else, MAGMA error is computed relative to cuBLAS result.

% transA = No transpose, transB = No transpose
%   M     N     K   MAGMA Gflop/s (ms)  cuBLAS Gflop/s (ms)   CPU Gflop/s (ms)  MAGMA error  cuBLAS error
%========================================================================================================
 1000  1000  1000    485.20 (   4.12)     907.47 (   2.20)     52.00 (  38.46)    8.23e-16     8.25e-16   ok
 2000  2000  2000    528.94 (  30.25)     942.12 (  16.98)     53.39 ( 299.67)    1.12e-15     1.12e-15   ok
 3000  3000  3000    551.91 (  97.84)    1007.24 (  53.61)     53.67 (1006.21)    1.55e-15     1.55e-15   ok
 4000  4000  4000    546.57 ( 234.19)    1008.84 ( 126.88)     54.03 (2369.22)    1.57e-15     1.57e-15   ok
Last edited by mgates3 on Wed Jul 15, 2015 10:47 pm, edited 1 time in total.
Reason: add 4 thread

ritadia
Posts: 7
Joined: Thu Jul 09, 2015 8:39 am

Re: testing_dgemm output

Post by ritadia » Thu Jul 16, 2015 3:46 am

thanks for the reply. But in my case even when i change the number of OMP threads and MKL threads it changes barely. Here are two examples:
the first one : i am running 8 GPU Tesla k80 with 12 OMP threads and 12 MKL threads.
the second one : i am running 8 GPU Tesla k80 with 24 OMP threads and 24 MKL threads.

The output for the first test:

Code: Select all


MAGMA 1.6.2  compiled for CUDA capability >= 2.0
CUDA runtime 7000, driver 7000. OpenMP threads 12. MKL 11.0.2, MKL threads 12. 
ndevices 8
device 0: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 1: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 2: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 3: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 4: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 5: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 6: Tesla K80, 823.5 MHz cloc[code]
k, 11519.6 MB memory, capability 3.7
device 7: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
Usage: ./testing_dgemm [options] [-h|--help]

If running lapack (option --lapack), MAGMA and cuBLAS error are both computed
relative to CPU BLAS result. Else, MAGMA error is computed relative to cuBLAS result.

transA = No transpose, transB = No transpose
M N K MAGMA Gflop/s (ms) cuBLAS Gflop/s (ms) CPU Gflop/s (ms) MAGMA error cuBLAS error
=========================================================================================================
15000 15000 15000 1008.92 (6690.30) 1018.23 (6629.18) 223.87 (30150.96) 3.14e-15 3.14e-15 ok
15000 15000 15000 1007.57 (6699.27) 1014.81 (6651.47) 224.67 (30043.92) 3.14e-15 3.14e-15 ok
15000 15000 15000 1007.29 (6701.16) 1015.41 (6647.55) 224.60 (30053.72) 3.14e-15 3.14e-15 ok
15000 15000 15000 1007.03 (6702.91) 1014.19 (6655.57) 224.78 (30029.74) 3.14e-15 3.14e-15 ok
15000 15000 15000 1005.44 (6713.47) 1016.73 (6638.91) 224.75 (30034.02) 3.14e-15 3.14e-15 ok
15000 15000 15000 1005.89 (6710.45) 1015.11 (6649.56) 224.72 (30037.70) 3.14e-15 3.14e-15 ok
15000 15000 15000 1006.60 (6705.77) 1014.91 (6650.82) 224.52 (30064.34) 3.14e-15 3.14e-15 ok
15000 15000 15000 1003.61 (6725.75) 1016.02 (6643.54) 224.65 (30046.46) 3.14e-15 3.14e-15 ok
15000 15000 15000 1004.20 (6721.75) 1015.18 (6649.09) 224.71 (30038.97) 3.14e-15 3.14e-15 ok
15000 15000 15000 1006.91 (6703.65) 1016.25 (6642.05) 224.67 (30044.62) 3.14e-15 3.14e-15 ok

[/code]

and here's the output for the second test:

Code: Select all

MAGMA 1.6.2  compiled for CUDA capability >= 2.0
CUDA runtime 7000, driver 7000. OpenMP threads 24. MKL 11.0.2, MKL threads 24. 
ndevices 8
device 0: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 1: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 2: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 3: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 4: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 5: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 6: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
device 7: Tesla K80, 823.5 MHz clock, 11519.6 MB memory, capability 3.7
Usage: ./testing_dgemm [options] [-h|--help]

If running lapack (option --lapack), MAGMA and cuBLAS error are both computed
relative to CPU BLAS result. Else, MAGMA error is computed relative to cuBLAS result.

transA = No transpose, transB = No transpose
    M     N     K   MAGMA Gflop/s (ms)  cuBLAS Gflop/s (ms)   CPU Gflop/s (ms)  MAGMA error  cuBLAS error
=========================================================================================================
15000 15000 15000   1009.67 (6685.36)    1017.05 (6636.83)    189.84 (35557.07)    3.14e-15     3.14e-15   ok
15000 15000 15000   1007.62 (6698.95)    1014.71 (6652.14)    196.98 (34267.81)    3.14e-15     3.14e-15   ok
15000 15000 15000   1008.22 (6694.99)    1012.61 (6665.93)    201.14 (33558.87)    3.14e-15     3.14e-15   ok
15000 15000 15000   1007.75 (6698.11)    1012.60 (6666.00)    195.70 (34491.18)    3.14e-15     3.14e-15   ok
15000 15000 15000   1008.28 (6694.57)    1013.42 (6660.61)    192.65 (35038.16)    3.14e-15     3.14e-15   ok
15000 15000 15000   1008.25 (6694.77)    1013.83 (6657.93)    199.61 (33815.60)    3.14e-15     3.14e-15   ok
15000 15000 15000   1009.60 (6685.80)    1013.78 (6658.23)    202.66 (33307.58)    3.14e-15     3.14e-15   ok
15000 15000 15000   1006.59 (6705.82)    1015.19 (6649.00)    199.14 (33895.15)    3.14e-15     3.14e-15   ok
15000 15000 15000   1006.48 (6706.53)    1014.05 (6656.46)    185.61 (36366.28)    3.14e-15     3.14e-15   ok
15000 15000 15000   1011.87 (6670.81)    1014.78 (6651.72)    191.77 (35198.02)    3.14e-15     3.14e-15   ok
It should increases , but it decreases !! i can't find out why
would you please explain this for me?

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: testing_dgemm output

Post by mgates3 » Thu Jul 16, 2015 9:51 am

How many actual cores do you have? Not counting hyper-threading.

Our system had 16 cores (2 sockets x 8 cores each). If you count hyper-threading, that goes to 32 cores. But hyper-threading doesn't help dense linear algebra operations, it hurts.

-mark

ritadia
Posts: 7
Joined: Thu Jul 09, 2015 8:39 am

Re: testing_dgemm output

Post by ritadia » Thu Jul 16, 2015 10:59 am

We do not have hyperthreading CPUs. For the example shown above, we ran the code on a node with 2 CPU and one mutual memory card (each CPU has 12 cores).

I will show you another output that i got today:
i ran the code on a node composed of four GPU k20 and 2 CPU (each CPU has 8 cores).
In all the tests below i used these four GPU k20 with different number of threads:

On my first test, i used 4 OMP threads and 4 MKL threads, here's the command line :

Code: Select all

export OMP_NUM_THREADS=4
export MKL_NUM_THREADS=4
./testing_dgemm --ngpu 4 -l --lapack -n 12000 -m 12000 -k 12000
And here's the output:

Code: Select all

MAGMA 1.6.2  compiled for CUDA capability >= 2.0
CUDA runtime 7000, driver 7000. OpenMP threads 4. MKL 11.0.2, MKL threads 4. 
ndevices 4
device 0: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
device 1: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
device 2: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
device 3: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
Usage: ./testing_dgemm [options] [-h|--help]

If running lapack (option --lapack), MAGMA and cuBLAS error are both computed
relative to CPU BLAS result. Else, MAGMA error is computed relative to cuBLAS result.

transA = No transpose, transB = No transpose
    M     N     K   MAGMA Gflop/s (ms)  cuBLAS Gflop/s (ms)   CPU Gflop/s (ms)  MAGMA error  cuBLAS error
=========================================================================================================
12000 12000 12000   1040.63 (3321.08)    1040.54 (3321.34)     92.56 (37339.90)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.67 (3320.95)    1040.69 (3320.86)     95.16 (36316.59)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.68 (3320.91)    1040.62 (3321.08)     95.37 (36238.70)    3.10e-15     3.10e-15   ok
12000 12000 12000   1040.81 (3320.49)    1040.56 (3321.28)     94.83 (36442.31)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.58 (3321.23)    1040.69 (3320.87)     95.36 (36241.56)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.66 (3320.98)    1040.61 (3321.13)     95.32 (36258.10)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.60 (3321.17)    1040.74 (3320.70)     95.38 (36235.39)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.62 (3321.11)    1040.57 (3321.24)     95.26 (36279.53)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.72 (3320.78)    1040.52 (3321.42)     95.08 (36346.60)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.71 (3320.80)    1040.70 (3320.83)     95.25 (36282.78)    3.10e-15     3.10e-15   ok

On the second test, i used 8 OMP threads and 8 MKL threads, here's the command line :

Code: Select all

export OMP_NUM_THREADS=8
export MKL_NUM_THREADS=8
./testing_dgemm --ngpu 4 -l --lapack -n 12000 -m 12000 -k 12000
And here's the output for the second test:

Code: Select all

MAGMA 1.6.2  compiled for CUDA capability >= 2.0
CUDA runtime 7000, driver 7000. OpenMP threads 8. MKL 11.0.2, MKL threads 8. 
ndevices 4
device 0: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
device 1: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
device 2: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
device 3: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
Usage: ./testing_dgemm [options] [-h|--help]

If running lapack (option --lapack), MAGMA and cuBLAS error are both computed
relative to CPU BLAS result. Else, MAGMA error is computed relative to cuBLAS result.

transA = No transpose, transB = No transpose
    M     N     K   MAGMA Gflop/s (ms)  cuBLAS Gflop/s (ms)   CPU Gflop/s (ms)  MAGMA error  cuBLAS error
=========================================================================================================
12000 12000 12000   1040.73 (3320.75)    1040.65 (3320.99)    169.09 (20438.53)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.61 (3321.13)    1040.55 (3321.31)    168.39 (20524.15)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.77 (3320.63)    1040.55 (3321.31)    168.20 (20547.42)    3.10e-15     3.10e-15   ok
12000 12000 12000   1040.58 (3321.23)    1040.72 (3320.77)    168.17 (20550.88)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.71 (3320.82)    1040.58 (3321.22)    168.20 (20546.49)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.65 (3321.01)    1040.77 (3320.62)    168.17 (20550.90)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.74 (3320.70)    1040.64 (3321.04)    168.21 (20545.74)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.63 (3321.07)    1040.76 (3320.65)    168.08 (20561.48)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.64 (3321.03)    1040.65 (3321.02)    168.20 (20547.26)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.58 (3321.23)    1040.62 (3321.11)    168.25 (20541.23)    3.10e-15     3.10e-15   ok

It seems working good till now. But when i ran my third test whit 16 OMP threads and 16 MKL threads, i got unexpected results . Here's the command line:

Code: Select all

export OMP_NUM_THREADS=16
export MKL_NUM_THREADS=16
./testing_dgemm --ngpu 4 -l --lapack -n 12000 -m 12000 -k 12000
And here's the output :

Code: Select all

MAGMA 1.6.2  compiled for CUDA capability >= 2.0
CUDA runtime 7000, driver 7000. OpenMP threads 16. MKL 11.0.2, MKL threads 16. 
ndevices 4
device 0: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
device 1: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
device 2: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
device 3: Tesla K20m, 705.5 MHz clock, 4799.6 MB memory, capability 3.5
Usage: ./testing_dgemm [options] [-h|--help]

If running lapack (option --lapack), MAGMA and cuBLAS error are both computed
relative to CPU BLAS result. Else, MAGMA error is computed relative to cuBLAS result.

transA = No transpose, transB = No transpose
    M     N     K   MAGMA Gflop/s (ms)  cuBLAS Gflop/s (ms)   CPU Gflop/s (ms)  MAGMA error  cuBLAS error
=========================================================================================================
12000 12000 12000   1040.73 (3320.73)    1040.42 (3321.75)    150.18 (23012.05)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.61 (3321.14)    1040.61 (3321.14)    156.31 (22109.40)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.73 (3320.73)    1040.63 (3321.08)    161.73 (21369.40)    3.10e-15     3.10e-15   ok
12000 12000 12000   1040.71 (3320.81)    1040.61 (3321.14)    152.84 (22611.34)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.77 (3320.63)    1040.75 (3320.69)    159.92 (21610.67)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.60 (3321.15)    1040.65 (3321.01)    155.08 (22284.91)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.63 (3321.06)    1040.77 (3320.63)    157.02 (22009.31)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.70 (3320.84)    1040.60 (3321.17)    155.85 (22174.61)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.62 (3321.10)    1040.62 (3321.11)    158.52 (21801.28)    3.09e-15     3.09e-15   ok
12000 12000 12000   1040.68 (3320.90)    1040.51 (3321.46)    156.51 (22081.38)    3.10e-15     3.10e-15   ok

I don't get why the performance decreases. Maybe it is considering only one CPU.
Thanks in advance for your reply.

mgates3
Posts: 918
Joined: Fri Jan 06, 2012 2:13 pm

Re: testing_dgemm output

Post by mgates3 » Thu Jul 16, 2015 11:15 am

What model CPU do you have?

If you unset OMP_NUM_THREADS and MKL_NUM_THREADS, what is the result? That would be use the number of cores that OpenMP or MKL thinks your system has. Though occasionally this is wrong -- we have one system that by default uses 32 OpenMP threads, when it has only 16 real (non-hyperthread) cores.

Thank you for including your input. Using numactl may help. It spreads the matrix over the numa nodes memory. See my previous examples.

Minor syntax things:
MKL will inherit OMP_NUM_THREADS, so if they are identical, you only need to set OMP_NUM_THREADS.

I suggest using capital -N m,n,k instead of lowercase -m m -n n -k k. Using lowercase is why it repeats 10 times. The lowercase ones are intended to override m, n, k when using --range, e.g.
--range 1000:4000:1000 -n 1000
does 1000x1000, 2000x1000, 3000x1000, 4000x1000.

--ngpu 4 doesn't do anything for this particular tester, as the gemm is single GPU.

-l and --lapack are the same.

ritadia
Posts: 7
Joined: Thu Jul 09, 2015 8:39 am

Re: testing_dgemm output

Post by ritadia » Fri Jul 17, 2015 3:38 am

The CPU model is : Intel(R) Xeon(R) CPU E5-2670 0 - 2.60GHz


If i unset OMP_NUM_THREADS and MKL_NUM_THREADS i get the same results as test 2 ( with 8 OMP threads and 8 MKL threads)


Concerning the numactl option, would you please send me the link where you include your examples?

Thanks for the remarks concerning the syntax.

One more question : i want to run all the GPUs with all the CPUs at the same time to test their performance, which test in the testing section do you think is the most effective? i am testing the testing_dgetrf_mgpu.
And do you know if i can run it on multiple nodes (with mpi ) ??

Post Reply