def thread_scaling_test(dry_run, target_dir, exp_name, group='', param_l=[]):
  from scripts.conf.conf import machine_info, machine_conf
  from scripts.pluto.pluto_utils import run_pluto_test, tee
  import itertools, os, pickle
  from os.path import join as jpath

  target_dir = jpath(os.path.abspath("."),target_dir)


  #update the pinning information to use all cores
  th_max = machine_info['n_cores']
  const_pin_args = machine_conf['pinning_args']


  # machine_info['hostname']=='IVB_10core'
  kernels_limits = {'3d25pt':1089, '3d7pt':1217, '3d25pt_var':577, '3d7pt_var':769}
  increment = 64

  if(machine_info['hostname']=='Haswell_18core'):
    kernels_limits = {'3d25pt':1281, '3d7pt':1409, '3d25pt_var':769, '3d7pt_var':897}
    increment = 128

  points = dict()
  points['3d7pt']      = [896]
  points['3d25pt']     = [896]
  points['3d7pt_var']  = [768]
  points['3d25pt_var'] = [768]

  count=0
  for kernel in ['3d7pt', '3d7pt_var', '3d25pt', '3d25pt_var']:
    for N in points[kernel]:
      # get the tuned parameters
      if(dry_run==1):
        nt=32; param=[-1,-1,-1]
      if (kernel, N, 'MEM') in param_l.keys(): # use the tuned params of memory results
        param, nt = param_l[(kernel, N, 'MEM')]
        nt_r = nt*2
      else:
        print "Tuning required for stencil:%s N:%d"%(kernel, N)
        continue

      for th in list(range(1,1+th_max)):
        outfile=('pluto_kernel_%s_N%d_th%d_%s_%s.txt' % (kernel, N, th, group, exp_name[-13:]))
        outfile = jpath(target_dir, outfile)
        machine_conf['pinning_args'] =  const_pin_args + str(th-1)

        nt = max(30, int(nt_r*float(th)/float(th_max)) )

        if(dry_run==0):
          fp = open(outfile, 'w')
          tee(fp, outfile)
#        print outfile, param
        test_str, telapsed = run_pluto_test(dry_run=dry_run, kernel=kernel, nx=N, ny=N, nz=N, nt=nt, params=param, outfile=outfile)
        if(dry_run==0):
          tee(fp, test_str)
          fp.close()
        count = count+1
  return count
def igs_test(dry_run, target_dir, exp_name, group='', param_l=[]):
  from scripts.conf.conf import machine_info
  from scripts.pluto.pluto_utils import run_pluto_test
  import itertools, os, pickle
  from os.path import join as jpath

  target_dir = jpath(os.path.abspath("."),target_dir)


  # machine_info['hostname']=='IVB_10core'
  kernels_limits = {'3d25pt':1089, '3d7pt':1217, '3d25pt_var':577, '3d7pt_var':769}
  increment = 64

  if(machine_info['hostname']=='Haswell_18core'):
    kernels_limits = {'3d25pt':1281, '3d7pt':1409, '3d25pt_var':769, '3d7pt_var':897}
    increment = 128

  points = dict()
  points['3d7pt'] = [64] + list(range(128, 5000, increment))
  points['3d7pt_var'] = points['3d7pt']
  points['3d25pt'] = points['3d7pt']
  points['3d25pt_var'] = points['3d7pt']

  count=0
  #for kernel in ['3d7pt', '3d7pt_var', '3d25pt']:#, '3d25pt_var']:
  for kernel in [ '3d25pt', '3d25pt_var']:
    for N in points[kernel]:
      if (N < kernels_limits[kernel]):
        outfile=('pluto_kernel_%s_N%d_%s_%s.txt' % (kernel, N, group, exp_name[-13:]))
        outfile = jpath(target_dir, outfile)
        if(dry_run==1):
          nt=32; param=[-1,-1,-1]
#        nt = max(int(k_time_scale[kernel]/(N**3/1e6)), 30)
        if (kernel, N, group) in param_l.keys():
          continue # results exist for this test case

        if (kernel, N, 'MEM') in param_l.keys(): # use the tuned params of memory results
          if(dry_run==0): fp = open(outfile, 'w')
          param, nt = param_l[(kernel, N, 'MEM')]
          nt = nt*2
        else:
#          continue
          if(dry_run==0): 
            fp = open(outfile, 'w')
            param, nt, tune_res = pluto_tuner(kernel=kernel, nx=N, ny=N, nz=N, fp=fp)
            with open(outfile[:-3]+'p', 'w') as fpickle:
              pickle.dump(tune_res, fpickle)
        if(dry_run==0): tee(fp, outfile)
#        print outfile, param
        test_str, telapsed = run_pluto_test(dry_run=dry_run, kernel=kernel, nx=N, ny=N, nz=N, nt=nt, params=param, outfile=outfile)
        if(dry_run==0):
          tee(fp, test_str)
          fp.close()
        count = count+1
  return count
示例#3
0
def thread_scaling_test(dry_run, target_dir, exp_name, group='', param_l=[]):
    from scripts.conf.conf import machine_info, machine_conf
    from scripts.pluto.pluto_utils import run_pluto_test, tee
    import itertools, os, pickle
    from os.path import join as jpath

    target_dir = jpath(os.path.abspath("."), target_dir)

    #update the pinning information to use all cores
    th_max = machine_info['n_cores']
    const_pin_args = machine_conf['pinning_args']

    # machine_info['hostname']=='IVB_10core'
    kernels_limits = {
        '3d25pt': 1089,
        '3d7pt': 1217,
        '3d25pt_var': 577,
        '3d7pt_var': 769
    }
    increment = 64

    if (machine_info['hostname'] == 'Haswell_18core'):
        kernels_limits = {
            '3d25pt': 1281,
            '3d7pt': 1409,
            '3d25pt_var': 769,
            '3d7pt_var': 897
        }
        increment = 128

    points = dict()
    points['3d7pt'] = [896]
    points['3d25pt'] = [896]
    points['3d7pt_var'] = [768]
    points['3d25pt_var'] = [768]

    count = 0
    for kernel in ['3d7pt', '3d7pt_var', '3d25pt', '3d25pt_var']:
        for N in points[kernel]:
            # get the tuned parameters
            if (dry_run == 1):
                nt = 32
                param = [-1, -1, -1]
            if (kernel, N, 'MEM'
                ) in param_l.keys():  # use the tuned params of memory results
                param, nt = param_l[(kernel, N, 'MEM')]
                nt_r = nt * 2
            else:
                print "Tuning required for stencil:%s N:%d" % (kernel, N)
                continue

            for th in list(range(1, 1 + th_max)):
                outfile = ('pluto_kernel_%s_N%d_th%d_%s_%s.txt' %
                           (kernel, N, th, group, exp_name[-13:]))
                outfile = jpath(target_dir, outfile)
                machine_conf['pinning_args'] = const_pin_args + str(th - 1)

                nt = max(30, int(nt_r * float(th) / float(th_max)))

                if (dry_run == 0):
                    fp = open(outfile, 'w')
                    tee(fp, outfile)


#        print outfile, param
                test_str, telapsed = run_pluto_test(dry_run=dry_run,
                                                    kernel=kernel,
                                                    nx=N,
                                                    ny=N,
                                                    nz=N,
                                                    nt=nt,
                                                    params=param,
                                                    outfile=outfile)
                if (dry_run == 0):
                    tee(fp, test_str)
                    fp.close()
                count = count + 1
    return count
def igs_test(dry_run, target_dir, exp_name, group='', param_l=[]):
    from scripts.conf.conf import machine_info
    from scripts.pluto.pluto_utils import run_pluto_test
    import itertools, os, pickle
    from os.path import join as jpath

    target_dir = jpath(os.path.abspath("."), target_dir)

    # machine_info['hostname']=='IVB_10core'
    kernels_limits = {
        '3d25pt': 1089,
        '3d7pt': 1217,
        '3d25pt_var': 577,
        '3d7pt_var': 769
    }
    increment = 64

    if (machine_info['hostname'] == 'Haswell_18core'):
        kernels_limits = {
            '3d25pt': 1281,
            '3d7pt': 1409,
            '3d25pt_var': 769,
            '3d7pt_var': 897
        }
        increment = 128

    points = dict()
    points['3d7pt'] = [64] + list(range(128, 5000, increment))
    points['3d7pt_var'] = points['3d7pt']
    points['3d25pt'] = points['3d7pt']
    points['3d25pt_var'] = points['3d7pt']

    count = 0
    #for kernel in ['3d7pt', '3d7pt_var', '3d25pt']:#, '3d25pt_var']:
    for kernel in ['3d25pt', '3d25pt_var']:
        for N in points[kernel]:
            if (N < kernels_limits[kernel]):
                outfile = ('pluto_kernel_%s_N%d_%s_%s.txt' %
                           (kernel, N, group, exp_name[-13:]))
                outfile = jpath(target_dir, outfile)
                if (dry_run == 1):
                    nt = 32
                    param = [-1, -1, -1]


#        nt = max(int(k_time_scale[kernel]/(N**3/1e6)), 30)
                if (kernel, N, group) in param_l.keys():
                    continue  # results exist for this test case

                if (kernel, N, 'MEM') in param_l.keys(
                ):  # use the tuned params of memory results
                    if (dry_run == 0): fp = open(outfile, 'w')
                    param, nt = param_l[(kernel, N, 'MEM')]
                    nt = nt * 2
                else:
                    #          continue
                    if (dry_run == 0):
                        fp = open(outfile, 'w')
                        param, nt, tune_res = pluto_tuner(kernel=kernel,
                                                          nx=N,
                                                          ny=N,
                                                          nz=N,
                                                          fp=fp)
                        with open(outfile[:-3] + 'p', 'w') as fpickle:
                            pickle.dump(tune_res, fpickle)
                if (dry_run == 0): tee(fp, outfile)
                #        print outfile, param
                test_str, telapsed = run_pluto_test(dry_run=dry_run,
                                                    kernel=kernel,
                                                    nx=N,
                                                    ny=N,
                                                    nz=N,
                                                    nt=nt,
                                                    params=param,
                                                    outfile=outfile)
                if (dry_run == 0):
                    tee(fp, test_str)
                    fp.close()
                count = count + 1
    return count