Creating PyOpenCl context causes later access viol

2019-08-20 10:10发布

问题:

I just started to experiment with OpenCL using pyopencl. I got it from here

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyopencl

I wrote some test programms and excecuting worked as expected. Than when I wanted to start a big batch of simulations I got random crashes with Access Violations (Windows Error Code FFFFFFFFC0000005) . It turns out that any script in which I import pyopencl and create a context crashes after one to two minute. I run 3 tests and got [63sec, 86sec, 81sec].

I have ensured that the context is always on my 'Intel(R) HD Graphics 620' card by setting the environment variable PYOPENCL_CTX = 1:0

import pyopencl as cl
ctx = cl.create_some_context()

import time

i = 0
while True:
    print("Im alive since %i seconds" % i, flush = True)
    i += 1
    time.sleep(1.0)

I have a Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] from python.org

Edit:

After removing the environment variable and just letting the shell sit in the choose platform dialog - wihtout choosing a platform - crashes after about a minute with Access Violation.

Edit:

I updated the Driver Vesion to the latest available 22.20.16.4771 (from 13/08/2017) but the problem persists.

回答1:

This may be due to outdated driver. In the case that the computer vendor does not provide up-to-date drivers a generic driver from Intel may work, eventhough there is no guarantee of compatibility.

Intel only provides driver as self installing .exe which don't allow driver installation when it notices that a custom version of there drivers is running.

However one can circumvent this check by letting the self uncompressing .exe uncrompess. Copy the data from the temp folder it creates and then manually install these drivers usind the widnows device manager. It goes without saying that this easily may break a setup.



标签: pyopencl