-
Notifications
You must be signed in to change notification settings - Fork 479
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
[SYSTEMML-1325] Cleanup static variables in DMLScript #832
Conversation
@niketanpansare - it appears that statistics are no longer printed as expected when run via the command line: Expected behavior is a printout of detailed SystemML statistics. However, only total execution time and number of spark instructions are printed. |
A couple issues with MLContext:
And
|
and finegrained statistics before execution
Thanks @thomas9t for catching that. Delivered the fix for that. |
Thanks @niketanpansare - I confirm that statistics are now printed as expected when run via the command line and in MLContext. |
I ran a few sanity checks on GPU behavior for MLContext and DMLScript:
Both APIs behave as expected. We can perform the same checks for JMLC as part of #830 |
@niketanpansare - I confirm that 69b991 fixed the NPE in MLContext. I also ran the standard test suite and didn't encounter any errors. I see no other issues. LGTM 👍 |
Thanks @thomas9t. Will merge 👍 |
Support to JMLC This PR adds support for compilation and execution of GPU enabled scripts in JMLC and harmonizes the pipeline used to compile and execute DML programs across the JMLC, MLContext and DMLScript. Specifically, the following changes were made: 1. All three APIs now call ScriptExecutorUtils.compileRuntimeProgram to compile DML scripts. The original logic in MLContext and JMLC for pinning inputs and persisting outputs has been preserved. 2. All three APIs now use ScriptExecutorUtils.executeRuntimeProgram to execute the compiled program. Previously, JMLC called the Script.execute method directly. 3. jmlc.Connection.prepareScript now supports compiling a script to use GPU. Note that following apache#832 the issue noted in apache#830 has been resolved. 4. A PreparedScript is now statically assigned a GPU context when it is compiled and instatiated. This has potential performance implications because it means that a PreparedScript must be executed on a specific GPU. However, it reduces overhead from creating a GPU context each time a script is executed and unsures that a user cannot compile a script to use GPU and then forget to assign a GPU context when the script is run. 5. Per (3) I have added a unit test which compiles and executes a GPU enabled script in JMLC both with and without pinned data and just asserts that no errors occur. Closes apache#836.
Support to JMLC This PR adds support for compilation and execution of GPU enabled scripts in JMLC and harmonizes the pipeline used to compile and execute DML programs across the JMLC, MLContext and DMLScript. Specifically, the following changes were made: 1. All three APIs now call ScriptExecutorUtils.compileRuntimeProgram to compile DML scripts. The original logic in MLContext and JMLC for pinning inputs and persisting outputs has been preserved. 2. All three APIs now use ScriptExecutorUtils.executeRuntimeProgram to execute the compiled program. Previously, JMLC called the Script.execute method directly. 3. jmlc.Connection.prepareScript now supports compiling a script to use GPU. Note that following #832 the issue noted in #830 has been resolved. 4. A PreparedScript is now statically assigned a GPU context when it is compiled and instatiated. This has potential performance implications because it means that a PreparedScript must be executed on a specific GPU. However, it reduces overhead from creating a GPU context each time a script is executed and unsures that a user cannot compile a script to use GPU and then forget to assign a GPU context when the script is run. 5. Per (3) I have added a unit test which compiles and executes a GPU enabled script in JMLC both with and without pinned data and just asserts that no errors occur. Closes #836.
We use ThreadLocal DMLOptions and DMLConfig instead of static variables in DMLScript class. It allows different JMLC instances (or MLCContext instances) to run with different options (such as with GPU, with CPU, etc).
@nakul02 @thomas9t @mboehm7 Please let me know if you have suggestions or concerns regarding this PR?