Check if results are binary correct
Check if results are binary correctΒΆ
import numpy as np
import pandas as pd
First we read in two reference files, one for the intel results, one for the gnu results
df_intel = pd.read_csv('reference_intel.csv', delimiter=' ')
df_gnu = pd.read_csv('benchmark_xeon.csv', delimiter=' ')
take the rows containing all the various matrix and vector sizes
values_intel = df_intel[['n','Nx','Ny','Nz','exblas_i']]
values_gnu = df_gnu[['n','Nx','Ny','Nz','exblas_i']].iloc[0:32]
values_intel.set_index(['n','Nx','Ny','Nz'], inplace=True)
values_gnu.set_index(['n','Nx','Ny','Nz'], inplace=True)
Make a dictionary of files and compilertypes that we want to check
files = {'knl_mpi1':'intel', 'knl_mpi2':'intel', 'knl_mpi4':'intel','knl_mpi8':'intel',
'skl_mpi1':'intel', 'skl_mpi2':'intel', 'skl_mpi4':'intel','skl_mpi8':'intel',
#'p100nv_mpi1':'gnu', 'p100nv_mpi2':'gnu', 'p100nv_mpi4':'gnu',
#'v100nv_mpi1':'gnu', 'v100nv_mpi2':'gnu', 'v100nv_mpi4':'gnu',
'xeon':'gnu','titanxp':'gnu'}
Now, go through all the files and all rows and compare the result (the exblas_i column) to the corresponding reference value
for f,k in files.items():
df=pd.read_csv('benchmark_'+f+'.csv', delimiter=' ')
Passed = True; Err = False
print( "Checking", f , k)
ref = values_gnu
#display(ref)
if k == 'intel' :
ref = values_intel
for i in df.index:
try:
if df.loc[i,'exblas_i'] != ref.loc[(df.loc[i,'n'],df.loc[i,'Nx'],df.loc[i,'Ny'],df.loc[i,'Nz']),'exblas_i'] and not pd.isnull(df.loc[i,'exblas_i']):
Passed = False
print( "Wrong result at n = ",df.loc[i,'n']," N = ",df.loc[i,'Nx'],
" Difference is ", df.loc[i,'exblas_i']-ref.loc[(df.loc[i,'n'],df.loc[i,'Nx'],df.loc[i,'Ny'],df.loc[i,'Nz']),'exblas_i'])
except KeyError:
Err = True
print(i)
continue
if Passed :
print( "PASSED")
else:
print( "FAILED")
if Err:
print( " There was a Key error")
Checking knl_mpi1 intel
PASSED
Checking knl_mpi2 intel
PASSED
Checking knl_mpi4 intel
PASSED
Checking knl_mpi8 intel
PASSED
Checking skl_mpi1 intel
PASSED
Checking skl_mpi2 intel
PASSED
Checking skl_mpi4 intel
PASSED
Checking skl_mpi8 intel
PASSED
Checking xeon gnu
PASSED
Checking titanxp gnu
PASSED