Exemplo n.º 1
0
def using_hyperthreading():
	if not lfu.using_os('windows'):
		print 'cant test hyperthreading when not using windows'
		return
	winmgmts_root = GetObject("winmgmts:root\cimv2")
	cpus = winmgmts_root.ExecQuery("Select * from Win32_Processor")
	for cpu in cpus:
		if cpu.NumberOfCores <= cpu.NumberOfLogicalProcessors:
			return True, cpu.DeviceID
		else: return False, cpu.DeviceID
Exemplo n.º 2
0
import libs.modular_core.libfundamental as lfu

#import pyopencl as cl; gpu_support = True
if lfu.using_os('mac'):
    gpu_support = False
    print 'gpu', gpu_support
else:
    try:
        import pyopencl as cl
        from pyopencl.tools import get_gl_sharing_context_properties
        gpu_support = True  #; print 'gpu', gpu_support
    except ImportError:
        cl = None
        gpu_support = False
        print 'gpu', gpu_support

import sys
import numpy as np
import os

import pdb

lib_path = os.path.join(os.getcwd(), 'libs', 'gpu')
gpu_cl_extensions = {
    'addition': os.path.join(lib_path, 'lib_gpu1to1addition.cl'),
    'subtraction': os.path.join(lib_path, 'lib_gpu1to1subtraction.cl'),
    'multiplication': os.path.join(lib_path, 'lib_gpu1to1multiplication.cl'),
    'division': os.path.join(lib_path, 'lib_gpu1to1division.cl'),
    'particlesim': os.path.join(lib_path, 'lib_gpuParticleSim.cl')
}
Exemplo n.º 3
0
import libs.modular_core.libfundamental as lfu

#import pyopencl as cl; gpu_support = True
if lfu.using_os('mac'):
	gpu_support = False; print 'gpu', gpu_support
else:
	try:
		import pyopencl as cl
		from pyopencl.tools import get_gl_sharing_context_properties
		gpu_support = True#; print 'gpu', gpu_support
	except ImportError: cl = None; gpu_support = False; print 'gpu', gpu_support

import sys 
import numpy as np
import os

import pdb

lib_path = os.path.join(os.getcwd(), 'libs', 'gpu')
gpu_cl_extensions = {
	'addition' : os.path.join(lib_path, 
				'lib_gpu1to1addition.cl'), 
	'subtraction' : os.path.join(lib_path, 
				'lib_gpu1to1subtraction.cl'), 
	'multiplication' : os.path.join(lib_path, 
				'lib_gpu1to1multiplication.cl'), 
	'division' : os.path.join(lib_path, 
				'lib_gpu1to1division.cl'), 
	'particlesim' : os.path.join(lib_path, 
				'lib_gpuParticleSim.cl')}
Exemplo n.º 4
0
import libs.modular_core.libfundamental as lfu
import libs.modular_core.libsettings as lset
import libs.gpu.lib_gpu as lgpu

if lfu.using_os('windows'):
	try: from win32com.client import GetObject
	except ImportError: pass

import multiprocessing as mp
import numpy as np
import types
import time

import pdb

if __name__ == 'libs.modular_core.libmultiprocess':
	if lfu.gui_pack is None: lfu.find_gui_pack()
	lgm = lfu.gui_pack.lgm

if __name__ == '__main__':
	print 'this is a library!'

class multiprocess_plan(lfu.plan):

	def __init__(self, parent = None, label = 'multiprocess plan'):
		self.worker_count = lset.get_setting('worker_processes')
		self.worker_report = []
		if lgpu.gpu_support: self.gpu_worker = lgpu.CL()
		use_plan = lset.get_setting('multiprocessing')
		lfu.plan.__init__(self, parent = parent, 
			label = label, use_plan = use_plan)