Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

summersurface
Copy link
Collaborator

  1. Get cpu result as benchmark, the result files matches the testcases in data.
  2. Add result compare funtion, you can use '-c' to activate result comparison, also remember to use '-v' to calculate the result vec.

@@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more explicit comments.

@@ -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

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

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".

Copy link
Collaborator Author

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 ******

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.

Copy link
Collaborator Author

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.

@@ -172,6 +193,28 @@ int main(int argc, char *argv[]) {
PrintAry(finalVec,size);
}

//compare finalvec is enough i think

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it

if (compare) {
if(size < 1)
{
// get resname from filename and rm / and change .txt to .res

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.

@Jules-Kong Jules-Kong added the bug Something isn't working label Sep 2, 2024

int i;
for (i = 0; i < size; i++) {
if (fabs(compareVec[i] - finalVec[i]) > 0.01) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please use scientific notation for the values ​​in the res file.
  2. Regarding precision differences, use the minimum difference in scientific notation or the equal sign.

exit(1);
}
}
printf("Results match expected results\n");

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");
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Free the compareVec pointer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done,

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]);

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.

{
int i;
for (i=0; i<ary_size; i++) {
fprintf(fp, "%f ", ary[i]);

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.

int i, j;
for (i=0; i<nrow; i++) {
for (j=0; j<ncol; j++) {
fprintf(fp, "%f ", *(ary+size*i+j));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like above.

@summersurface summersurface force-pushed the 10-ventus-add-comparisons-in-opecl-testcases branch from 05e2bb8 to 6f84fa0 Compare September 4, 2024 06:11
adjust compare filename and precision
@summersurface summersurface force-pushed the 10-ventus-add-comparisons-in-opecl-testcases branch from 6f84fa0 to f65e135 Compare September 4, 2024 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants