Bohrium

Bohrium is a runtime-system for mapping vector operations onto a number of different hardware platforms, from simple multi-core systems to clusters and GPU enabled systems.

A typical example is acceleration of Python/NumPy code using the Bohrium runtime system. The first line in the following heat diffusion solver imports “bohrium as np” instead of “numpy as np”, which is the only modification needed.

For more information please see www.bh107.org


import bohrium as np
import matplotlib.pyplot as plt

def solve(height, width, epsilon=0.005):
  grid = np.zeros((height+2,width+2),dtype=np.float64)
  grid[:,0]  = -273.15
  grid[:,-1] = -273.15
  grid[-1,:] = -273.15
  grid[0,:]  = 40.0
  center = grid[1:-1,1:-1]
  north  = grid[:-2,1:-1]
  south  = grid[2:,1:-1]
  east   = grid[1:-1,:-2]
  west   = grid[1:-1,2:]
  delta  = epsilon+1
  while delta > epsilon:
    tmp = 0.2*(center+north+south+east+west)
    delta = np.sum(np.abs(tmp-center))
    center[:] = tmp
  plt.matshow(center, cmap='hot')
  plt.show()

>>solve(100,100)

Comments