You developed a serial algorithm to combine N integers stored in an array, X, into a single integer: y. y = X[0]; for(i

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

You developed a serial algorithm to combine N integers stored in an array, X, into a single integer: y. y = X[0]; for(i

Post by answerhappygod »

You developed a serial algorithm to combine N integers stored in
an array, X, into a single
integer: y.
y = X[0];
for(i = 1; i < N; i++){
y = y + X + y*X;
}
The operation, π‘Ž ⨀ 𝑏 = π‘Ž+ 𝑏 + π‘ŽΓ— 𝑏, is invoked in every iteration.
As you can see, this
operation is commutative and associative. This means that you may
apply this operation
recursively to pairs of numbers in a list in any order and still
obtain the correct result.
Now you need to accelerate this serial algorithm by off-loading
most of its computation to GPU.
The remaining computation can be finished off in the CPU. Please
implement the kernel
function below. Create any variable that you need to use in the
kernel function or assume that
they have been created elsewhere for you. Please pay attention to
properly handling the
boundary conditions in the kernel function
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply