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_i5.csv', delimiter=' ')
take the rows containing all the various matrix and vector sizes
values_intel = df_intel[['n','Nx','Ny','exblas_i']]
values_gnu = df_gnu[['n','Nx','Ny','exblas_i']].iloc[0:32]
values_intel.set_index(['n','Nx'], inplace=True)
values_gnu.set_index(['n','Nx'], inplace=True)
Make a dictionary of files and compilertypes that we want to check
files = {'knl_mpi1':'intel', 'knl_mpi2':'intel', 'knl_mpi4':'intel',
'skl_mpi1':'intel', 'skl_mpi2':'intel', 'skl_mpi4':'intel',
'p100_mpi1':'gnu', 'p100_mpi2':'gnu', 'p100_mpi4':'gnu',
'v100_mpi1':'gnu', 'v100_mpi2':'gnu', 'v100_mpi4':'gnu',
'i5':'gnu','gtx1060':'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
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']),'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']),'exblas_i'])
except KeyError:
Err = True
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 skl_mpi1 intel
PASSED
Checking skl_mpi2 intel
PASSED
Checking skl_mpi4 intel
PASSED
Checking p100_mpi1 gnu
PASSED
Checking p100_mpi2 gnu
PASSED
Checking p100_mpi4 gnu
PASSED
Checking v100_mpi1 gnu
PASSED
Checking v100_mpi2 gnu
PASSED
Checking v100_mpi4 gnu
PASSED
Checking i5 gnu
PASSED
Checking gtx1060 gnu
PASSED