I have the below code written in php and have been reading up on Cuda to utilize the GPU processing power of my old Geforce 8800 Ultra. How do I convert this nested combinations test to Cuda parallel processing code (if even possible...)? The total combinations of the 2d arrays: $a, $b, $c, $d, $e quickly rise into the trillions...
foreach($a as $aVal){
foreach($b as $bVal){
foreach($c as $cVal){
foreach($d as $dVal){
foreach($e as $eVal){
$addSum = $aVal[0]+$bVal[0]+$cVal[0]+$dVal[0]+$eVal[0];
$capSum = $aVal[1]+$bVal[1]+$cVal[1]+$dVal[1]+$eVal[1];
if($capSum <= CAP_LIMIT){
$tempArr = array("a" => $aVal[2],"b" => $aVal[2],"c" => $aVal[2],
"d" => $aVal[2],"e" => $aVal[2],"addTotal" => $addSum,"capTotal" => $capSum);
array_push($topCombinations, $tempArr);
if(count($topCombinations) > 1000){
$topCombinations = $ca->arraySortedDescend($topCombinations);
array_splice($topCombinations, 900);
}
}
}
}
}
}
}