public static void calculateFitnessOnDevice(GThread thread, float[] dev_fitnesses, float[,] groundTruth, float[] userTrusts, UserUpdate[, ,] updates, FitnessParameter[] dev_fitnessParams) { int tid = thread.blockIdx.x * thread.blockDim.x + thread.threadIdx.x; if (tid < dev_fitnesses.Length) { dev_fitnesses[tid] = Fitness.fitness(groundTruth, userTrusts, updates, dev_fitnessParams[tid]); } }
// most time consuming, can be run in parallel private float[] calculatePopulationFitness() { for (int i = 0; i < fitnessParams.Length; i++) { fs[i] = Fitness.fitness(researchData.GroundTruth, researchData.UserTrusts, researchData.Updates, fitnessParams[i]); } return(fs); }