Skip to content

Commit 425d841

Browse files
author
Diptorup Deb
committed
Merge branch 'upstream_master'
2 parents e34ad68 + 6684c7b commit 425d841

19 files changed

+594
-515
lines changed

.git-blame-ignore-revs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs
2+
3+
# Migrate code style to Black
4+
41ccd65e2e659aa0add0e5ab59f1a46e32cc4c46

.github/workflows/black.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This is a workflow to format Python code with black formatter
2+
3+
name: black
4+
5+
# Controls when the action will run. Triggers the workflow on push or pull request
6+
# events but only for the master branch
7+
on:
8+
push:
9+
branches: [master]
10+
pull_request:
11+
branches: [master]
12+
13+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
14+
jobs:
15+
# This workflow contains a single job called "black"
16+
black:
17+
# The type of runner that the job will run on
18+
runs-on: ubuntu-latest
19+
20+
# Steps represent a sequence of tasks that will be executed as part of the job
21+
steps:
22+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
23+
- uses: actions/checkout@v2
24+
# Set up a Python environment for use in actions
25+
- uses: actions/setup-python@v2
26+
27+
# Run black code formatter
28+
- uses: psf/black@stable

CONTRIBUTING.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
Coming soon
1+
# Python code style
2+
3+
## black
4+
5+
We use [black](https://black.readthedocs.io/en/stable/) code formatter.
6+
7+
- Revision: `20.8b1` or branch `stable`.
8+
- See configuration in `pyproject.toml`.
9+
10+
Run before each commit: `black .`

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
2+
13
What?
24
====
35
A lightweight Python package exposing a subset of OpenCL and SYCL

dpctl/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
## This top-level dpctl module.
2323
##
2424
##===----------------------------------------------------------------------===##
25-
'''
25+
"""
2626
Data Parallel Control (dpCtl)
2727
2828
dpCtl provides a lightweight Python abstraction over DPC++/SYCL and
@@ -43,12 +43,13 @@
4343
4444
Please use `pydoc dpctl.ocldrv` to look at the current API for dpctl.ocldrv.
4545
46-
'''
46+
"""
4747
__author__ = "Intel Corp."
4848

4949
from ._sycl_core import *
5050
from ._version import get_versions
5151

52+
5253
def get_include():
5354
"""
5455
Return the directory that contains the dpCtl *.h header files.
@@ -57,7 +58,9 @@ def get_include():
5758
this function to locate the appropriate include directory.
5859
"""
5960
import os.path
60-
return os.path.join(os.path.dirname(__file__), 'include')
6161

62-
__version__ = get_versions()['version']
62+
return os.path.join(os.path.dirname(__file__), "include")
63+
64+
65+
__version__ = get_versions()["version"]
6366
del get_versions

dpctl/_sycl_core.pxd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,6 @@ cdef class SyclQueue:
118118
cpdef void wait (self)
119119
cdef DPPLSyclQueueRef get_queue_ref (self)
120120
cpdef memcpy (self, dest, src, int count)
121+
122+
123+
cpdef SyclQueue get_current_queue()

dpctl/_sycl_core.pyx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ cdef class _SyclRTManager:
626626
'''
627627
return self.get_current_queue().get_sycl_device().get_device_type()
628628

629-
def get_current_queue (self):
629+
cpdef SyclQueue get_current_queue (self):
630630
''' Returns the activated SYCL queue as a PyCapsule.
631631
'''
632632
return SyclQueue._create(DPPLQueueMgr_GetCurrentQueue())
@@ -736,7 +736,6 @@ _mgr = _SyclRTManager()
736736

737737
# Global bound functions
738738
dump = _mgr.dump
739-
get_current_queue = _mgr.get_current_queue
740739
get_current_device_type = _mgr.get_current_device_type
741740
get_num_platforms = _mgr.get_num_platforms
742741
get_num_activated_queues = _mgr.get_num_activated_queues
@@ -747,6 +746,10 @@ has_sycl_platforms = _mgr.has_sycl_platforms
747746
set_default_queue = _mgr.set_default_queue
748747
is_in_device_context = _mgr.is_in_device_context
749748

749+
cpdef SyclQueue get_current_queue():
750+
''' Obtain current Sycl Queue from Data Parallel Control package '''
751+
return _mgr.get_current_queue()
752+
750753

751754
def create_program_from_source (SyclQueue q, unicode source, unicode copts=""):
752755
''' Creates a Sycl interoperability program from an OpenCL source string.

0 commit comments

Comments
 (0)