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

[VL] Make jni debug workspace configurable #6228

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

Yohahaha
Copy link
Contributor

What changes were proposed in this pull request?

Add new config spark.gluten.sql.debug.keepJniWorkspaceDir to store libraries, and decouple the functionality from spark.gluten.sql.debug

Copy link

Thanks for opening a pull request!

Could you open an issue for this pull request on Github Issues?

https://github.com/apache/incubator-gluten/issues

Then could you also rename commit message and pull request title in the following format?

[GLUTEN-${ISSUES_ID}][COMPONENT]feat/fix: ${detailed message}

See also:

Copy link

Run Gluten Clickhouse CI

@@ -75,14 +75,14 @@ private static JniWorkspace createDefault() {
}
}

public static void enableDebug() {
public static void enableDebug(String debugDir) {
Copy link
Member

Choose a reason for hiding this comment

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

What happens if debugDir changed by user in session?

We either handle the case or just raise an error (by making the option static or adding assertion in code).

Copy link
Member

Choose a reason for hiding this comment

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

@Yohahaha Let's still add an assertion to make sure the function doesn't get call twice with different debugDir values. In case the method is used in test code or somewhere. Thanks.

That may involve adding another global variable but it could be worth it I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so you think DEBUG_INSTANCE will be initialized twice in one process? if yes, we should refactor jni initialization first.

Copy link
Member

@zhztheplayer zhztheplayer Jun 26, 2024

Choose a reason for hiding this comment

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

so you think DEBUG_INSTANCE will be initialized twice in one process

Nope. Just a protection in this method assuming unpredictable caller code. E.g., One could call enableDebug(...) for test purpose. We'd throw something otherwise the second call will be silently swallowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this functionality should only be called once by design from my understanding, if someone want call it twice, I think they dont know that they did. We dont really need protect anything.
Related conf already be static and enableDebug has ensure only initialize DEBUG_INSTANCE once.

Copy link
Member

@zhztheplayer zhztheplayer Jun 26, 2024

Choose a reason for hiding this comment

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

I think they dont know that they did. We dont really need protect anything.

I think anti cases are appearing easier than we think it could be.

For example, if someone in test code, calling JniWorkspace.enableDebug("folder1") for debug purpose, however in somewhere a Spark config spark.gluten.sql.debug.keepJniWorkspaceDir=folder2 was already set for some reason.

Then he could go mad because the files were not found in folder1 and the console doesn't tell him anything about that.

Copy link
Contributor

Choose a reason for hiding this comment

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

As a debug conf, I feel that we don't need to provide excessive protection for the user.

Copy link
Member

Choose a reason for hiding this comment

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

enableDebug("folder1") should just enable debug in folder folder1. If there's potential that it doesn't use folder1, please give user/caller a note.

I don't think it's excessive protection. Next time please close comments like this one before merging a PR.

Comment on lines 1588 to 1592
val DEBUG_KEEP_JNI_WORKSPACE_DIR =
buildConf(GLUTEN_DEBUG_KEEP_JNI_WORKSPACE_DIR)
.internal()
.stringConf
.createWithDefault("/tmp")
Copy link
Member

@zhztheplayer zhztheplayer Jun 26, 2024

Choose a reason for hiding this comment

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

I think we can make the conf static, as well as DEBUG_KEEP_JNI_WORKSPACE. Thanks.

Copy link

Run Gluten Clickhouse CI

1 similar comment
@Yohahaha
Copy link
Contributor Author

Run Gluten Clickhouse CI

Copy link
Contributor

@liujiayi771 liujiayi771 left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for adding this configuration, it is very helpful for troubleshooting.

@Yohahaha Yohahaha merged commit 0800596 into apache:main Jun 26, 2024
40 checks passed
@Yohahaha Yohahaha deleted the refine-debug-jni-config branch June 26, 2024 12:01
deepashreeraghu pushed a commit to deepashreeraghu/incubator-gluten that referenced this pull request Jun 26, 2024
@GlutenPerfBot
Copy link
Contributor

===== Performance report for TPCDS SF2000 with Velox backend, for reference only ====

query log/native_master_06_26_2024_time.csv log/native_master_06_25_2024_524434826b_time.csv difference percentage
q1 14.62 15.17 0.549 103.75%
q2 17.50 16.06 -1.437 91.79%
q3 4.47 4.34 -0.126 97.17%
q4 64.49 63.83 -0.654 98.99%
q5 7.81 7.93 0.116 101.48%
q6 4.14 3.82 -0.314 92.40%
q7 4.22 6.09 1.869 144.30%
q8 5.63 5.43 -0.196 96.51%
q9 18.75 17.23 -1.523 91.88%
q10 10.87 10.45 -0.417 96.16%
q11 40.96 35.36 -5.594 86.34%
q12 1.58 2.56 0.980 161.83%
q13 5.39 5.60 0.212 103.93%
q14a 42.12 42.28 0.162 100.39%
q14b 42.17 43.18 1.006 102.39%
q15 2.73 2.68 -0.047 98.27%
q16 38.62 38.10 -0.511 98.68%
q17 4.78 5.00 0.223 104.66%
q18 6.43 6.32 -0.112 98.26%
q19 3.14 2.28 -0.856 72.73%
q20 1.65 1.41 -0.245 85.17%
q21 2.69 2.61 -0.081 97.00%
q22 10.67 8.45 -2.222 79.18%
q23a 84.61 85.41 0.806 100.95%
q23b 103.24 102.86 -0.378 99.63%
q24a 74.63 79.91 5.274 107.07%
q24b 72.65 77.03 4.376 106.02%
q25 4.74 6.28 1.539 132.46%
q26 2.91 2.88 -0.031 98.94%
q27 9.17 3.18 -5.990 34.65%
q28 22.92 23.41 0.489 102.13%
q29 8.25 8.17 -0.079 99.04%
q30 4.33 8.53 4.193 196.75%
q31 6.31 6.87 0.560 108.87%
q32 1.22 1.30 0.079 106.45%
q33 4.83 4.81 -0.027 99.45%
q34 3.58 3.59 0.017 100.47%
q35 6.46 6.63 0.166 102.58%
q36 3.29 3.36 0.070 102.12%
q37 4.05 4.12 0.074 101.83%
q38 11.79 11.99 0.201 101.71%
q39a 3.55 3.23 -0.318 91.04%
q39b 2.87 2.93 0.063 102.20%
q40 6.01 3.65 -2.362 60.71%
q41 0.62 0.60 -0.017 97.29%
q42 0.94 1.01 0.068 107.22%
q43 3.86 3.85 -0.009 99.78%
q44 8.95 8.70 -0.246 97.26%
q45 3.62 3.47 -0.150 95.86%
q46 4.60 3.40 -1.194 74.03%
q47 14.25 14.12 -0.137 99.04%
q48 4.58 4.64 0.066 101.45%
q49 9.49 9.78 0.285 103.00%
q50 22.38 23.83 1.443 106.45%
q51 8.78 8.76 -0.025 99.71%
q52 1.03 0.99 -0.040 96.08%
q53 2.01 2.02 0.011 100.52%
q54 3.22 3.36 0.142 104.41%
q55 0.96 0.95 -0.014 98.49%
q56 4.47 4.40 -0.068 98.49%
q57 8.60 8.51 -0.092 98.94%
q58 2.56 2.49 -0.077 96.98%
q59 14.06 16.06 2.005 114.26%
q60 8.08 4.86 -3.215 60.19%
q61 5.76 5.61 -0.150 97.39%
q62 4.44 4.96 0.524 111.81%
q63 2.35 2.20 -0.147 93.75%
q64 49.07 49.93 0.860 101.75%
q65 15.30 13.87 -1.422 90.70%
q66 3.54 5.77 2.234 163.18%
q67 348.90 348.45 -0.448 99.87%
q68 3.80 3.63 -0.169 95.55%
q69 6.58 6.62 0.036 100.54%
q70 13.30 12.08 -1.214 90.87%
q71 2.37 2.34 -0.030 98.73%
q72 191.80 189.44 -2.366 98.77%
q73 2.70 2.84 0.145 105.36%
q74 21.14 21.37 0.227 101.07%
q75 23.11 23.37 0.253 101.10%
q76 9.17 9.21 0.043 100.47%
q77 2.27 2.26 -0.012 99.48%
q78 41.17 41.15 -0.021 99.95%
q79 3.48 3.71 0.231 106.65%
q80 10.95 11.29 0.334 103.05%
q81 4.85 5.23 0.376 107.76%
q82 9.66 10.25 0.586 106.06%
q83 1.77 1.55 -0.225 87.27%
q84 2.66 2.73 0.066 102.48%
q85 6.68 6.80 0.120 101.79%
q86 3.35 3.31 -0.039 98.84%
q87 12.18 12.23 0.051 100.42%
q88 24.96 27.25 2.292 109.18%
q89 3.27 3.49 0.221 106.75%
q90 8.00 9.20 1.199 114.98%
q91 2.58 2.80 0.215 108.31%
q92 1.31 1.49 0.180 113.78%
q93 29.00 28.96 -0.036 99.88%
q94 21.28 21.28 -0.001 100.00%
q9 83.19 83.88 0.682 100.82%
q5 3.78 3.80 0.018 100.46%
q96 12.45 12.32 -0.132 98.94%
q97 2.01 2.03 0.023 101.13%
q98 9.96 9.77 -0.192 98.07%
q99 9.96 9.77 -0.192 98.07%
total 1928.06 1930.61 2.551 100.13%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants