diff --git a/src/psyclone/gocean1p0.py b/src/psyclone/gocean1p0.py index e077f5366d..bda307dd02 100644 --- a/src/psyclone/gocean1p0.py +++ b/src/psyclone/gocean1p0.py @@ -790,8 +790,8 @@ def gen_ocl(self, parent): kernel = "kernel_" + self._name # TODO use namespace manager - parent.add(UseGen(parent, name="ocl_env_mod", only=True, - funcnames=["create_buffer"])) + parent.add(UseGen(parent, name="fortcl", only=True, + funcnames=["create_rw_buffer"])) # Ensure fields are on device TODO this belongs somewhere else! parent.add(CommentGen(parent, " Ensure field data is on device")) @@ -815,16 +815,18 @@ def gen_ocl(self, parent): parent.add(DeclGen(parent, datatype="integer", kind="c_intptr_t", target=True, entity_decls=["write_event"])) - - size_expr = "int({0}%grid%nx*{0}%grid%ny, 8)*c_sizeof({1}(1,1))".\ - format(garg.name, host_buff) + # Use c_sizeof() on first element of array to be copied over in + # order to cope with the fact that some grid properties are + # integer. + size_expr = ("int({0}%grid%nx*{0}%grid%ny, 8)*" + "c_sizeof({1}(1,1))".format(garg.name, host_buff)) ifthen.add(AssignGen(ifthen, lhs="size_in_bytes", rhs=size_expr)) ifthen.add(CommentGen(ifthen, " Create buffer on device")) ifthen.add(AssignGen( ifthen, lhs=device_buff, - rhs="create_buffer(CL_MEM_READ_WRITE, size_in_bytes)")) + rhs="create_rw_buffer(size_in_bytes)")) ifthen.add(AssignGen( ifthen, lhs="ierr", rhs="clEnqueueWriteBuffer(cmd_queues(1), {0}, " diff --git a/src/psyclone/psyGen.py b/src/psyclone/psyGen.py index 7259dcd8f6..0650f7e1fe 100644 --- a/src/psyclone/psyGen.py +++ b/src/psyclone/psyGen.py @@ -387,7 +387,7 @@ def gen_ocl_init(self, parent, kernels): CallGen, UseGen, CommentGen, CharDeclGen, IfThenGen sub = SubroutineGen(parent, "psy_init") parent.add(sub) - sub.add(UseGen(sub, name="ocl_env_mod", only=True, + sub.add(UseGen(sub, name="fortcl", only=True, funcnames=["ocl_env_init", "add_kernels"])) # Add a logical variable used to ensure that this routine is only # executed once. @@ -1423,7 +1423,7 @@ def gen_code(self, parent): if self._opencl: parent.add(UseGen(parent, name="iso_c_binding")) parent.add(UseGen(parent, name="clfortran")) - parent.add(UseGen(parent, name="ocl_env_mod", only=True, + parent.add(UseGen(parent, name="fortcl", only=True, funcnames=["get_num_cmd_queues", "get_cmd_queues", "get_kernel_by_name"]))