{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## doctest from psyclone.transformations.OMPLoopTrans" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from psyclone.parse.algorithm import parse\n", "from psyclone.parse.utils import ParseError\n", "from psyclone.psyGen import PSyFactory, GenerationError" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "dict_keys(['invoke_0'])\n" ] } ], "source": [ "api=\"gocean1.0\"\n", "filename = \"alg.f90\"\n", "ast, invokeInfo = parse(filename, api=api, invoke_name=\"invoke\")\n", "psy = PSyFactory(api).create(invokeInfo)\n", "print(psy.invokes.names)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "from psyclone.psyGen import TransInfo\n", "t = TransInfo()\n", "ltrans = t.get_trans_name('OMPLoopTrans')\n", "rtrans = t.get_trans_name('OMPParallelTrans')\n", "trans = t.get_trans_name('OMPParallelLoopTrans')" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "GOInvokeSchedule[invoke='invoke_0', Constant loop bounds=True]\n", " Loop[type='outer', field_space='go_cu', it_space='go_internal_pts']\n", " Literal[value:'2']\n", " Literal[value:'jstop']\n", " Literal[value:'1']\n", " Schedule[]\n", " Loop[type='inner', field_space='go_cu', it_space='go_internal_pts']\n", " Literal[value:'2']\n", " Literal[value:'istop+1']\n", " Literal[value:'1']\n", " Schedule[]\n", " CodedKern compute_cu_code(cu_fld,p_fld,u_fld) [module_inline=False]\n", " Loop[type='outer', field_space='go_cv', it_space='go_internal_pts']\n", " Literal[value:'2']\n", " Literal[value:'jstop+1']\n", " Literal[value:'1']\n", " Schedule[]\n", " Loop[type='inner', field_space='go_cv', it_space='go_internal_pts']\n", " Literal[value:'2']\n", " Literal[value:'istop']\n", " Literal[value:'1']\n", " Schedule[]\n", " CodedKern compute_cv_code(cv_fld,p_fld,v_fld) [module_inline=False]\n", " Loop[type='outer', field_space='go_cf', it_space='go_internal_pts']\n", " Literal[value:'2']\n", " Literal[value:'jstop+1']\n", " Literal[value:'1']\n", " Schedule[]\n", " Loop[type='inner', field_space='go_cf', it_space='go_internal_pts']\n", " Literal[value:'2']\n", " Literal[value:'istop+1']\n", " Literal[value:'1']\n", " Schedule[]\n", " CodedKern compute_z_code(z_fld,p_fld,u_fld,v_fld,dx,dy) [module_inline=False]\n", " Loop[type='outer', field_space='go_ct', it_space='go_internal_pts']\n", " Literal[value:'2']\n", " Literal[value:'jstop']\n", " Literal[value:'1']\n", " Schedule[]\n", " Loop[type='inner', field_space='go_ct', it_space='go_internal_pts']\n", " Literal[value:'2']\n", " Literal[value:'istop']\n", " Literal[value:'1']\n", " Schedule[]\n", " CodedKern compute_h_code(h_fld,p_fld,u_fld,v_fld) [module_inline=False]\n" ] } ], "source": [ "schedule = psy.invokes.get('invoke_0').schedule\n", "schedule.view()\n", "new_schedule = schedule" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Apply the OpenMP Loop transformation to *every* loop in the schedule" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "for child in schedule.children:\n", " newschedule, memento = ltrans.apply(child, reprod=True)\n", " schedule = newschedule" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Enclose all of these loops within a single OpenMP PARALLEL region" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "schedule\n", "\n" ] } ], "source": [ "newschedule, memento = rtrans.apply(schedule.children)\n", "print(newschedule.dag_name)\n", "print(memento)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# OMPParallelLoopTrans" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "from psyclone.transformations import OMPParallelLoopTrans" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "ename": "ParseError", "evalue": "\"Parse Error: In the dynamo0.3 API the 1st argument of a meta_arg entry should be a valid argument type (one of ['gh_field', 'gh_operator', 'gh_columnwise_operator', 'gh_real', 'gh_integer']), but found 'gh_rw' in 'arg_type(gh_rw, v3, fe, .true., .false., .true.)'\"", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mParseError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mast\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minvokeInfo\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparse\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"dynamo.F90\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mpsy\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mPSyFactory\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"dynamo0.1\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minvokeInfo\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mschedule\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpsy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minvokes\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'invoke_v3_kernel_type'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mschedule\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mschedule\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mview\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/Development/python/workspace/notebooks/venv/lib/python3.7/site-packages/psyclone/parse/algorithm.py\u001b[0m in \u001b[0;36mparse\u001b[0;34m(alg_filename, api, invoke_name, kernel_path, line_length)\u001b[0m\n\u001b[1;32m 100\u001b[0m \u001b[0;31m# function for compatibility.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0mmy_parser\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mParser\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mapi\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minvoke_name\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkernel_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mline_length\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 102\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmy_parser\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mparse\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0malg_filename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 103\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 104\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/Development/python/workspace/notebooks/venv/lib/python3.7/site-packages/psyclone/parse/algorithm.py\u001b[0m in \u001b[0;36mparse\u001b[0;34m(self, alg_filename)\u001b[0m\n\u001b[1;32m 218\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mcall_name\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_invoke_name\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlower\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 219\u001b[0m \u001b[0;31m# The call statement is an invoke\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 220\u001b[0;31m \u001b[0minvoke_call\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate_invoke_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 221\u001b[0m \u001b[0minvoke_calls\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minvoke_call\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 222\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/Development/python/workspace/notebooks/venv/lib/python3.7/site-packages/psyclone/parse/algorithm.py\u001b[0m in \u001b[0;36mcreate_invoke_call\u001b[0;34m(self, statement)\u001b[0m\n\u001b[1;32m 265\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margument\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mData_Ref\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mPart_Ref\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 266\u001b[0m \u001b[0;31m# This should be a kernel call.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 267\u001b[0;31m \u001b[0mkernel_call\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcreate_kernel_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margument\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 268\u001b[0m \u001b[0mkernel_calls\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkernel_call\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 269\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/Development/python/workspace/notebooks/venv/lib/python3.7/site-packages/psyclone/parse/algorithm.py\u001b[0m in \u001b[0;36mcreate_kernel_call\u001b[0;34m(self, argument)\u001b[0m\n\u001b[1;32m 302\u001b[0m \u001b[0;31m# This is a coded kernel\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 303\u001b[0m kernel_call = self.create_coded_kernel_call(\n\u001b[0;32m--> 304\u001b[0;31m kernel_name, args)\n\u001b[0m\u001b[1;32m 305\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mkernel_call\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 306\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/Development/python/workspace/notebooks/venv/lib/python3.7/site-packages/psyclone/parse/algorithm.py\u001b[0m in \u001b[0;36mcreate_coded_kernel_call\u001b[0;34m(self, kernel_name, args)\u001b[0m\n\u001b[1;32m 375\u001b[0m return KernelCall(module_name,\n\u001b[1;32m 376\u001b[0m KernelTypeFactory(api=self._api).create(\n\u001b[0;32m--> 377\u001b[0;31m modast, name=kernel_name), args)\n\u001b[0m\u001b[1;32m 378\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 379\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mupdate_arg_to_module_map\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/Development/python/workspace/notebooks/venv/lib/python3.7/site-packages/psyclone/parse/kernel.py\u001b[0m in \u001b[0;36mcreate\u001b[0;34m(self, parse_tree, name)\u001b[0m\n\u001b[1;32m 236\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_type\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"dynamo0.3\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 237\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpsyclone\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdynamo0p3\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mDynKernMetadata\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 238\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mDynKernMetadata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparse_tree\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 239\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_type\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"gocean0.1\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 240\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mpsyclone\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgocean0p1\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mGOKernelType\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/Development/python/workspace/notebooks/venv/lib/python3.7/site-packages/psyclone/dynamo0p3.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, ast, name)\u001b[0m\n\u001b[1;32m 846\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_arg_descriptors\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 847\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0marg_type\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_inits\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 848\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_arg_descriptors\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mDynArgDescriptor03\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0marg_type\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 849\u001b[0m \u001b[0;31m# parse the func_type metadata if it exists\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 850\u001b[0m \u001b[0mfound\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/Development/python/workspace/notebooks/venv/lib/python3.7/site-packages/psyclone/dynamo0p3.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, arg_type)\u001b[0m\n\u001b[1;32m 555\u001b[0m \u001b[0;34m\"{0}), but found '{1}' in '{2}'\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 556\u001b[0m format(GH_VALID_ARG_TYPE_NAMES, arg_type.args[0].name,\n\u001b[0;32m--> 557\u001b[0;31m arg_type))\n\u001b[0m\u001b[1;32m 558\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_type\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0marg_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 559\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mParseError\u001b[0m: \"Parse Error: In the dynamo0.3 API the 1st argument of a meta_arg entry should be a valid argument type (one of ['gh_field', 'gh_operator', 'gh_columnwise_operator', 'gh_real', 'gh_integer']), but found 'gh_rw' in 'arg_type(gh_rw, v3, fe, .true., .false., .true.)'\"" ] } ], "source": [ "ast, invokeInfo = parse(\"dynamo.F90\")\n", "psy = PSyFactory(\"dynamo0.1\").create(invokeInfo)\n", "schedule = psy.invokes.get('invoke_v3_kernel_type').schedule\n", "schedule.view()" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "ename": "TransformationError", "evalue": "'Transformation Error: Error in OMPParallelLoopTrans transformation. The node is not a loop.'", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mTransformationError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mtrans\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOMPParallelLoopTrans\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mnew_schedule\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmemento\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtrans\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mschedule\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mchildren\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m~/Development/python/workspace/notebooks/venv/lib/python3.7/site-packages/psyclone/transformations.py\u001b[0m in \u001b[0;36mapply\u001b[0;34m(self, node)\u001b[0m\n\u001b[1;32m 939\u001b[0m :py:class:`psyclone.undoredo.Memento`)\n\u001b[1;32m 940\u001b[0m '''\n\u001b[0;32m--> 941\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_validate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 942\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 943\u001b[0m \u001b[0mschedule\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnode\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroot\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/Development/python/workspace/notebooks/venv/lib/python3.7/site-packages/psyclone/transformations.py\u001b[0m in \u001b[0;36m_validate\u001b[0;34m(self, node)\u001b[0m\n\u001b[1;32m 911\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mnode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mLoop\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 912\u001b[0m raise TransformationError(\"Error in {0} transformation. The \"\n\u001b[0;32m--> 913\u001b[0;31m \"node is not a loop.\".format(self.name))\n\u001b[0m\u001b[1;32m 914\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 915\u001b[0m \u001b[0;31m# Check we are not a sequential loop\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mTransformationError\u001b[0m: 'Transformation Error: Error in OMPParallelLoopTrans transformation. The node is not a loop.'" ] } ], "source": [ "trans = OMPParallelLoopTrans()\n", "new_schedule, memento = trans.apply(schedule.children[0])" ] } ], "metadata": { "kernelspec": { "display_name": "venv", "language": "python", "name": "venv" }, "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.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }