Conversation
summersurface
commented
Sep 2, 2024
- Get cpu result as benchmark, the result files matches the testcases in data.
- Add result compare funtion, you can use '-c' to activate result comparison, also remember to use '-v' to calculate the result vec.
opencl/gaussian/run
Outdated
| # ./gaussian.out -s 2048 $@ | ||
| ./gaussian.out -p 0 -d 0 -f ../../data/gaussian/matrix4.txt -v | ||
| ./gaussian.out -p 0 -d 0 -f ../../data/gaussian/matrix4.txt -c -v | ||
| # 3 4 16 208 1024 No newline at end of file |
opencl/gaussian/Makefile
Outdated
| run:$(EXE) | ||
| ./gaussian.out -p 0 -d 0 -f ../../data/gaussian/matrix5.txt -v | ||
| # ./$(EXE) -s 4 -p 0 -d 0 | ||
| ./gaussian.out -p 0 -d 0 -f ../../data/gaussian/matrix5.txt -c |
| -p [int] Choose the platform (must choose both platform and device) | ||
| -d [int] Choose the device (must choose both platform and device) | ||
|
|
||
| -c Compare the result to a precomputed result |
There was a problem hiding this comment.
Add the relevant description of "-v".
There was a problem hiding this comment.
This version remove the relation between -v and -c.
| make clean | ||
| make KERNEL_DIM="-DRD_WG_SIZE_0=16 -DRD_WG_SIZE_1_0=16 -DRD_WG_SIZE_1_1=16" | ||
|
|
||
| ****** Compare ****** |
There was a problem hiding this comment.
Write this paragraph in the "-c" part in the same way as line 54.
There was a problem hiding this comment.
It is more redundant than other character styles.
opencl/gaussian/gaussianElim.cpp
Outdated
| PrintAry(finalVec,size); | ||
| } | ||
|
|
||
| //compare finalvec is enough i think |
opencl/gaussian/gaussianElim.cpp
Outdated
| if (compare) { | ||
| if(size < 1) | ||
| { | ||
| // get resname from filename and rm / and change .txt to .res |
There was a problem hiding this comment.
It is recommended to use the "matrix1024_result.txt" format.
opencl/gaussian/gaussianElim.cpp
Outdated
|
|
||
| int i; | ||
| for (i = 0; i < size; i++) { | ||
| if (fabs(compareVec[i] - finalVec[i]) > 0.01) { |
There was a problem hiding this comment.
- Please use scientific notation for the values in the res file.
- Regarding precision differences, use the minimum difference in scientific notation or the equal sign.
opencl/gaussian/gaussianElim.cpp
Outdated
| exit(1); | ||
| } | ||
| } | ||
| printf("Results match expected results\n"); |
There was a problem hiding this comment.
Uses a fixed format to indicate that the use case has passed.
| } | ||
| printf("Results match expected results\n"); | ||
| } | ||
|
|
opencl/gaussian/gaussianElim.cpp
Outdated
| int i; | ||
| for (i = 0; i < size; i++) { | ||
| if (fabs(compareVec[i] - finalVec[i]) > 0.01) { | ||
| printf("Error: finalVec[%d] = %f, while compareVec[%d] = %f\n", i, finalVec[i], i, compareVec[i]); |
There was a problem hiding this comment.
Replace %f with a higher precision method.
opencl/gaussian/gaussianElim.cpp
Outdated
| { | ||
| int i; | ||
| for (i=0; i<ary_size; i++) { | ||
| fprintf(fp, "%f ", ary[i]); |
There was a problem hiding this comment.
Please use scientific notation for the values in the res file.
opencl/gaussian/gaussianElim.cpp
Outdated
| int i, j; | ||
| for (i=0; i<nrow; i++) { | ||
| for (j=0; j<ncol; j++) { | ||
| fprintf(fp, "%f ", *(ary+size*i+j)); |
05e2bb8 to
6f84fa0
Compare
adjust compare filename and precision
6f84fa0 to
f65e135
Compare