<commit_before><commit_msg>Added a jacobi iterative stencil benchmark<commit_after>import numpy as np
import cphvbnumpy
import util

B = util.Benchmark()
H = B.size[0]
W = B.size[1]
iterations = B.size[2]

full = np.empty((H+2,W+2), dtype=np.double, dist=B.cphvb)
work = np.empty((H,W), dtype=np.double, dist=B.cphvb)
full[:]    = 0.0
full[:,0]  = -273.15
full[:,-1] = -273.15
full[0,:]  =  40.0
full[-1,:] = -273.13

B.start()
for i in xrange(iterations):
  work[:] = full[1:-1, 1:-1]
  work += full[1:-1, 0:-2]
  work += full[1:-1, 2:  ]
  work += full[0:-2, 1:-1]
  work += full[2:  , 1:-1]
  work *= 0.2
  diff = np.absolute(full[1:-1, 1:-1] - work)
  delta = np.add.reduce(diff)
  delta = np.add.reduce(delta)
  full[1:-1, 1:-1] = work
B.stop()

B.pprint()
{'fraction_non_alphanumeric': 0.22864651773981604, 'fraction_numerical': 0.07490144546649145, 'mean_word_length': 3.4302325581395348, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1336007', 'n_tokens_mistral': 375, 'n_tokens_neox': 352, 'n_words': 74}