From 97f71521db00ad49f68d4fa1a0604ad183a271d2 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Sun, 7 Oct 2012 13:17:11 -0400 Subject: [PATCH] Fix assumption that programs get build on devices in input order. (reported by Tom Zielinski) --- pyopencl/cache.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyopencl/cache.py b/pyopencl/cache.py index bf368d4a..0b258369 100644 --- a/pyopencl/cache.py +++ b/pyopencl/cache.py @@ -387,10 +387,11 @@ def _create_built_program_from_source_cached(ctx, src, options, devices, cache_d prg_bins = prg.get_info(_cl.program_info.BINARIES) prg_logs = prg._get_build_logs() - for i, dest_index in enumerate(to_be_built_indices): - assert prg_devs[i] == devices[dest_index] - binaries[dest_index] = prg_bins[i] - _, logs[dest_index] = prg_logs[i] + for dest_index in to_be_built_indices: + dev = devices[dest_index] + src_index = prg_devs.index(dev) + binaries[dest_index] = prg_bins[src_index] + _, logs[dest_index] = prg_logs[src_index] if len(to_be_built_indices) == len(devices): # Important special case: if code for all devices was built, -- GitLab