Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7537129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:45:54+00:00 2026-05-30T06:45:54+00:00

I have the below code written in php and have been reading up on

  • 0

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);

                        }
                    }  
                }
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:45:55+00:00Added an answer on May 30, 2026 at 6:45 am

    This is a very wide-open question. It requires conversion between languages as well as designing a parallel algorithm. I won’t go into too much detail, but in a nutshell:

    How you parallelize it depends on the size of your arrays ($a – $e). If they are large enough, you could parallelize only the outer one or two loops across threads in a grid, and do the inner loops sequentially. If they are not super large, you might want to either flatten 2-3 of the outer loops or possibly implement them using 2D or 3D thread blocks and grids in CUDA.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL singleton class written in PHP. Its code is listed below:
I have written below code in htaccess RewriteRule ^([a-zA-Z_-]+).php$ http://www.domain.com/myfile.php?page=inc- $1.php [NC] I don't
I have written a very simple WCF service, that worked fine (code below), then
I have written an autogenerating sitemap code below, it is called every 12 hours.
I have below code written with Eclipse ide: public interface X { final public
Below is the code I have written based on the example given here Google
I have below lines in my code written in C on unix platform. Please
Look at the test code I have written below. Using pure java I set
I have below code in html. <li class=selected runat=server id=lihome><a href=/ISS/home.aspx title=Home><span>Home</span></a></li> Now I
I have below code behind in c# if (Session[cmpDictionaryTitle]!= null) { downloadLinks.Text += @<li><a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.