# See the License for the specific language governing permissions and # limitations under the License. import dpctl import syclbuffer_naive as sb import numpy as np X = np.full((10 ** 4, 4098), 1e-4, dtype="d") # warm-up print("=" * 10 + " Executing warm-up " + "=" * 10) print("NumPy result: ", X.sum(axis=0)) print( "SYCL(default_device) result: {}".format( sb.columnwise_total(X), ) ) import timeit print( "Running time of 100 calls to columnwise_total on matrix with shape {}".format( X.shape ) ) print("Times for default_selector, inclusive of queue creation:") print( timeit.repeat( stmt="sb.columnwise_total(X)",
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import timeit import numpy as np import syclbuffer_naive as sb X = np.full((10**4, 4098), 1e-4, dtype="d") # warm-up print("=" * 10 + " Executing warm-up " + "=" * 10) print("NumPy result: ", X.sum(axis=0)) print("SYCL(default_device) result: {}".format(sb.columnwise_total(X), )) print("Running time of 100 calls to columnwise_total on matrix with " "shape {}".format(X.shape)) print("Times for default_selector, inclusive of queue creation:") print( timeit.repeat( stmt="sb.columnwise_total(X)", setup="sb.columnwise_total(X)", # ensure JIT compilation is not counted number=100, globals=globals(), )) print("Times for NumPy") print(timeit.repeat(stmt="X.sum(axis=0)", number=100, globals=globals()))
import syclbuffer_naive as sb import numpy as np X = np.random.randn(20, 10) # compute column-wise total with NumPy's own host code print(X.sum(axis=0)) # compute column-wise total with SYCL extension print(sb.columnwise_total(X))