Created
June 6, 2017 06:26
-
-
Save kmaehashi/ef5931ab758db1fdaa08474596eec5ec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import cupy | |
import threading | |
import random | |
import sys | |
# enable memory pool | |
cupy.cuda.memory.set_allocator(cupy.cuda.memory.MemoryPool().malloc) | |
def run(): | |
cupy.cuda.runtime.free(0) | |
while True: | |
print(".") | |
x = cupy.arange(int(2000000 * random.random())) | |
for i in range(10): | |
x = x - 1 | |
threads = [] | |
for x in range(2): | |
threads.append(threading.Thread(target=run)) | |
for t in threads: t.setDaemon(True) | |
for t in threads: t.start() | |
for t in threads: t.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment