Skip to content

add result compare in gaussian#2

Open
summersurface wants to merge 1 commit intomasterfrom
10-ventus-add-comparisons-in-opecl-testcases
Open

add result compare in gaussian#2
summersurface wants to merge 1 commit intomasterfrom
10-ventus-add-comparisons-in-opecl-testcases

Conversation

@summersurface
Copy link
Copy Markdown
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.

# ./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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add more explicit comments.

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
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unify the specified files.

-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
Copy link
Copy Markdown

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
Copy Markdown
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.

make clean
make KERNEL_DIM="-DRD_WG_SIZE_0=16 -DRD_WG_SIZE_1_0=16 -DRD_WG_SIZE_1_1=16"

****** Compare ******
Copy link
Copy Markdown

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
Copy Markdown
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.

PrintAry(finalVec,size);
}

//compare finalvec is enough i think
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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) {
Copy link
Copy Markdown

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");
Copy link
Copy Markdown

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

Copy link
Copy Markdown

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
Copy Markdown
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]);
Copy link
Copy Markdown

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]);
Copy link
Copy Markdown

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));
Copy link
Copy Markdown

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