Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3. (exercise 1.3) Try to write pseudo-code for the tree-structured global sum illustrated in Figure 1.1. Assume the number of cores is a power of
3. (exercise 1.3) Try to write pseudo-code for the tree-structured global sum illustrated in Figure 1.1. Assume the number of cores is a power of two (1,2,4, 8,...). Hints: Use a variable divisor to determine whether a core should send its sum or receive and add. The divisor should start with the value 2 and be doubled after each iteration. Also use a variable core difference to deter- mine which core should be partnered with the current core. It should start with the value 1 and also be doubled after each iteration. For example, in the first iteration of divisor = 0 and 1 % divisor = 1, so 0 receives and adds, while 1 sends. Also, in the first iteration 0 + core difference = 1 and 1 - core_difference = 0, so 0 and 1 are paired in the first iteration. Cores 3. (exercise 1.3) Try to write pseudo-code for the tree-structured global sum illustrated in Figure 1.1. Assume the number of cores is a power of two (1,2,4, 8,...). Hints: Use a variable divisor to determine whether a core should send its sum or receive and add. The divisor should start with the value 2 and be doubled after each iteration. Also use a variable core difference to deter- mine which core should be partnered with the current core. It should start with the value 1 and also be doubled after each iteration. For example, in the first iteration of divisor = 0 and 1 % divisor = 1, so 0 receives and adds, while 1 sends. Also, in the first iteration 0 + core difference = 1 and 1 - core_difference = 0, so 0 and 1 are paired in the first iteration. Cores
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started