public static void main(String[] _args) {

		final int NUMELEMENTS = 40;
		double[] inArray = new double[NUMELEMENTS];
		double[] outArray = new double[NUMELEMENTS];

		// initialize inArray
		for (int i=0; i<NUMELEMENTS; i++) {
			inArray[i] = (double)i;
		}
	
		String sourceFileName = "groupsize.hsail";
		String squaresSource = null;
		try {
			squaresSource = new String(Files.readAllBytes(FileSystems.getDefault().getPath( sourceFileName)));
		}
		catch(IOException e) {
			e.printStackTrace();
			System.exit(-1);
		}

		OkraContext context = new OkraContext();
		if (!context.isValid()) {System.out.println("...unable to create context"); System.exit(-1);}
		OkraKernel kernel = new OkraKernel(context, squaresSource, "&run");
		if (!kernel.isValid()) {System.out.println("...unable to create kernel"); System.exit(-1);}
		
		for (int gsize=0; gsize<10; gsize++) {
			System.out.println("results for workitems=" + NUMELEMENTS + ", groupSize=" + gsize);
			kernel.setLaunchAttributes(NUMELEMENTS, gsize); // 1 dimension, different groupsizes tried
			// we need to call the ...UsingRawArrays version because that's
			// what our hand coded hsail was written for
			kernel.dispatchWithArgsUsingRawArrays(outArray, inArray, gsize * 0.111);
			
			for (int i=0; i<NUMELEMENTS; i++) {
				System.out.print(i + "->" +  outArray[i] + ",  ");
			}
			System.out.println("\n");
		}
	}