def check_grid_size(s): utils.print_nbytes('gpu (global)', s.nx_gpu, s.ny, s.nz, 9) for i, nx in enumerate(s.nxs): nbytes = utils.print_nbytes('gpu #%d' %i, nx, s.ny, s.nz, 9) gmem_size = s.gpu_devices[i].get_info(cl.device_info.GLOBAL_MEM_SIZE) if nbytes >= gmem_size: print('Error: The grid size %d is over the global memory %d.' %(nbytes, gmem_size)) sys.exit() if s.nz % 32 != 0: print('Error: nz is not multiple of 32') sys.exit()
def check_grid_size(s): nbytes = utils.print_nbytes('cpu', s.nx, s.ny, s.nz, 9) for line in open('/proc/meminfo'): if 'MemTotal' in line: mem_size = int(line[line.find(':')+1:line.rfind('kB')]) * 1024 break if nbytes >= mem_size: print('Error: The grid size %d is over the host memory %d.' %(nbytes, gmem_size)) sys.exit() if s.nz % 4 != 0: print('Error: nz is not multiple of 4') sys.exit()
def check_grid_size(s): nbytes = utils.print_nbytes('cpu', s.nx, s.ny, s.nz, 9) for line in open('/proc/meminfo'): if 'MemTotal' in line: mem_size = int( line[line.find(':') + 1:line.rfind('kB')]) * 1024 break if nbytes >= mem_size: print('Error: The grid size %d is over the host memory %d.' % (nbytes, gmem_size)) sys.exit() if s.nz % 4 != 0: print('Error: nz is not multiple of 4') sys.exit()
#!/usr/bin/env python from utils import print_nbytes for i in xrange(1, 16): nx = i * 32 head_str = 'i = %d, nx = %d, ' % (i, nx) print_nbytes(head_str, nx, nx, nx, 9)
def check_grid_size(s): nbytes = utils.print_nbytes('cpu', s.nx, s.ny, s.nz, 9)