Bouncer / Untitled.ipynb
Untitled.ipynb
Raw
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "b43834bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "from numba import njit, prange\n",
    "import numpy as np\n",
    "\n",
    "@njit(parallel=True)\n",
    "def prange_ok_result_whole_arr(x):\n",
    "    n = x.shape[0]\n",
    "    y = np.zeros(4)\n",
    "    for i in prange(n):\n",
    "        y += x[i]\n",
    "    return y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "17ae5fb5",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "OMP: Info #271: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([10., 10., 10., 10.])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prange_ok_result_whole_arr(np.array([1,2,3,4]))"
   ]
  }
 ],
 "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
}