-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add result compare in gaussian #2
base: master
Are you sure you want to change the base?
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
@@ -1,4 +1,5 @@ | |||
#!/bin/bash | |||
|
|||
# ./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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add more explicit comments.
opencl/gaussian/Makefile
Outdated
@@ -16,8 +16,8 @@ release: | |||
$(CC) $(KERNEL_DIM) $(CC_FLAGS) $(SRC) -o $(EXE) -I$(OPENCL_INC) -L$(OPENCL_LIB) -lOpenCL -I../util -DTIMING -Wno-unused-result | |||
|
|||
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unify the specified files.
@@ -52,7 +52,7 @@ Gaussian Elimination Usage | |||
|
|||
-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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the relevant description of "-v".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version remove the relation between -v and -c.
@@ -66,3 +66,8 @@ The actually dimension = RD_WG_SIZE_1_0 * RD_WG_SIZE_1_1 | |||
USAGE: | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Write this paragraph in the "-c" part in the same way as line 54.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is more redundant than other character styles.
opencl/gaussian/gaussianElim.cpp
Outdated
@@ -172,6 +193,28 @@ int main(int argc, char *argv[]) { | |||
PrintAry(finalVec,size); | |||
} | |||
|
|||
//compare finalvec is enough i think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uses a fixed format to indicate that the use case has passed.
} | ||
printf("Results match expected results\n"); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Free the compareVec pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done,
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like above.
05e2bb8
to
6f84fa0
Compare
adjust compare filename and precision
6f84fa0
to
f65e135
Compare