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

Gpu dltensor operator #1261

Merged
merged 30 commits into from
Oct 17, 2019
Merged

Gpu dltensor operator #1261

merged 30 commits into from
Oct 17, 2019

Conversation

banasraf
Copy link
Collaborator

Why we need this PR?

  • It adds a GPU DLTensorPythonFunction operator, which can be later used to implement more specific GPU operators like Cupy operator or to extend existing TorchPythonFunction operator for GPU tensors.

What happened in this PR?

  • Explain solution of the problem, new feature added.
    It extends the existing DLTensor operator to support GPU tensors. Most of the work was done by implementing the CPU operator.
    The most important part is the CopyWithStride function for the GPU, as the rest of the code is just repeating the logic from the CPU operator.

JIRA TASK: [DALI-574]

Rafal added 13 commits August 26, 2019 10:27
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@banasraf
Copy link
Collaborator Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [903516]: BUILD STARTED

Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [903636]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [903516]: BUILD PASSED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [903636]: BUILD PASSED

Rafal added 2 commits September 17, 2019 13:34
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@banasraf
Copy link
Collaborator Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [905467]: BUILD STARTED

Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [905655]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [905655]: BUILD PASSED

Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [935573]: BUILD PASSED

Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@banasraf
Copy link
Collaborator Author

banasraf commented Oct 9, 2019

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [937421]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [937421]: BUILD FAILED

dali/pipeline/operators/python_function/CMakeLists.txt Outdated Show resolved Hide resolved
dali/test/python/test_dltensor_operator.py Outdated Show resolved Hide resolved
dali/test/python/test_dltensor_operator.py Show resolved Hide resolved
cupy_case(cupy_kernel_mix_channels)


def test_cupy_kernel_gray_scale():
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use yield as before:

def test_cupy():
    for testcase in [cupy_simple,  cupy_kernel_square_diff, cupy_kernel_mix_channels, cupy_kernel_gray_scale]:
        yield cupy_case, testcase

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, nice trick

dali/python/nvidia/dali/ops.py Outdated Show resolved Hide resolved
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@banasraf
Copy link
Collaborator Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [943583]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [943583]: BUILD PASSED

@@ -116,6 +116,20 @@ void PythonFunctionImpl<CPUBackend>::RunImpl(SampleWorkspace &ws) {
}
}

static cudaStream_t current_cuda_stream = nullptr;

cudaStream_t GetCurrentStream() {
Copy link
Contributor

Choose a reason for hiding this comment

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

How this GetCurrentStream is suppose to be used?

Rafal added 3 commits October 15, 2019 16:49
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
fix
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@banasraf
Copy link
Collaborator Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [945702]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [945702]: BUILD PASSED

Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@banasraf
Copy link
Collaborator Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [947100]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [947100]: BUILD FAILED

Signed-off-by: Rafal <Banas.Rafal97@gmail.com>
@banasraf
Copy link
Collaborator Author

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [948783]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [948783]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [948783]: BUILD PASSED

@banasraf banasraf merged commit 6be0cfa into NVIDIA:master Oct 17, 2019
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