{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "69c32066", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import numpy as np\n", "import pyclesperanto_prototype as cle\n", "import timeit\n", "\n", "cle.select_device(\"RTX\")" ] }, { "cell_type": "code", "execution_count": 2, "id": "0d5e8e7a", "metadata": {}, "outputs": [], "source": [ "inp = cle.create((1024, 1024, 40))\n", "out = cle.create((1024, 1024, 40))" ] }, { "cell_type": "code", "execution_count": 3, "id": "6f7f61c0", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The slowest run took 10.12 times longer than the fastest. This could mean that an intermediate result is being cached.\n", "2.31 ms ± 1.79 ms per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n" ] } ], "source": [ "%timeit cle.add_image_and_scalar(inp, out, scalar = 5)" ] }, { "cell_type": "code", "execution_count": 4, "id": "58651618", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'cupy backend (experimental)'" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cle.select_device(\"cupy\")" ] }, { "cell_type": "code", "execution_count": 5, "id": "690dde8e", "metadata": {}, "outputs": [], "source": [ "inp = cle.create((1024, 1024, 40))\n", "out = cle.create((1024, 1024, 40))" ] }, { "cell_type": "code", "execution_count": 6, "id": "bb399ac9", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "c:\\structure\\code\\pyclesperanto_prototype\\pyclesperanto_prototype\\_tier0\\_cuda_backend.py:31: UserWarning: clesperanto's cupy / CUDA backend is experimental. Please use it with care. The following functions are known to cause issues in the CUDA backend:\n", "affine_transform, apply_vector_field, create(uint64), create(int32), create(int64), label_spots, labelled_spots_to_pointlist, resample, scale, spots_to_pointlist\n", " warnings.warn(\"clesperanto's cupy / CUDA backend is experimental. Please use it with care. The following functions are known to cause issues in the CUDA backend:\\n\" +\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "The slowest run took 7.37 times longer than the fastest. This could mean that an intermediate result is being cached.\n", "1.23 ms ± 1.02 ms per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n" ] } ], "source": [ "%timeit cle.add_image_and_scalar(inp, out, scalar = 5)" ] }, { "cell_type": "code", "execution_count": null, "id": "b50fddfc", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.12" } }, "nbformat": 4, "nbformat_minor": 5 }