xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #2022: test_cuda_context_gil.py

File test_cuda_context_gil.py, 671 bytes (added by Antoine Martin, 2 years ago)

test if make_context releases the GIL

Line 
1#!/usr/bin/env python
2# This file is part of Xpra.
3# Copyright (C) 2019 Antoine Martin <antoine@xpra.org>
4# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
5# later version. See the file COPYING for details.
6
7import sys
8import time
9
10def print_thread():
11    while True:
12        sys.stdout.write("*")
13        sys.stdout.flush()
14        time.sleep(0.1)
15
16from threading import Thread
17t = Thread(target=print_thread)
18t.daemon = True
19t.start()
20
21time.sleep(0)
22from pycuda import driver
23
24print("initilizing device")
25device = driver.Device(0)
26print("device=%s" % (device,))
27context = device.make_context()
28print("context=%s" % (context,))
29print("done")