From 41c39e4440df871ab36f28aa9b0d44ed3f12eb5d Mon Sep 17 00:00:00 2001 From: ph Date: Sun, 19 Nov 2017 23:01:47 +0100 Subject: [PATCH] big case --- transport_cl.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) mode change 100644 => 100755 transport_cl.py diff --git a/transport_cl.py b/transport_cl.py old mode 100644 new mode 100755 index 81a8c60..2eb8117 --- a/transport_cl.py +++ b/transport_cl.py @@ -1,6 +1,13 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- + +# resolution of a transport equation by the finite volume method +# on regular grid + +# regular python implementation compared to a pyopencl version + + from __future__ import absolute_import, print_function import pyopencl as cl import numpy as np @@ -60,6 +67,7 @@ def solve_python(m = _m, nx = _nx, ny = _ny, Tmax = _Tmax, dx = _dx, dy = _dy, #init t = 0. wn = np.full((nx,ny), wbord, dtype = 'float32') + print("start Python computations...") for i in range(1,nx-1): for j in range(1,ny-1): xy=[i*dx+dx/2,j*dy+dy/2] @@ -138,6 +146,7 @@ def solve_ocl(m = _m, nx = _nx, ny = _ny, Tmax = _Tmax, dx = _dx, dy = _dy, elapsed = 0.; wn_cpu = np.empty((nx * ny, ), dtype = np.float32) + print("start OpenCL computations...") while t < Tmax: t = t + dt iter = iter + 1 -- GitLab