Question: Order of Memory Access ~~~~~~~~~~~~~~~~~~~~~~ Below are several memory layouts of A / B elements to consider. - - - - - - - -
Order of Memory Access ~~~~~~~~~~~~~~~~~~~~~~ Below are several memory layouts of AB elements to consider. Byte Offset LAYOUT A A A A A B B B B B Byte Offset LAYOUT A B A B A B A B A B For each of following, indicate the best suited option. The intfieldbase' approach code that is timed.. Uses memory LAYOUT and visit elements in the order A B A B A B etc. X Uses memory LAYOUT and visit elements in the order A A A B B B etc. Uses memory LAYOUT and visit elements in the order A B A B A B etc. Uses memory LAYOUT and visit elements in the order A A A B B B etc. The arrfieldbase' approach code that is timed.. Uses memory LAYOUT and visit elements in the order A B A B A B etc. X Uses memory LAYOUT and visit elements in the order A A A B B B etc. Uses memory LAYOUT and visit elements in the order A B A B A B etc. Uses memory LAYOUT and visit elements in the order A A A B B B etc. The intfieldoptm' approach code that is timed.. Uses memory LAYOUT and visit elements in the order A B A B A B etc. Uses memory LAYOUT and visit elements in the order A A A B B B etc. X Uses memory LAYOUT and visit elements in the order A B A B A B etc. Uses memory LAYOUT and visit elements in the order A A A B B B etc. The arrfieldoptm' approach code that is timed.. X Uses memory LAYOUT and visit elements in the order A B A B A B etc. Uses memory LAYOUT and visit elements in the order A A A B B B etc. Uses memory LAYOUT and visit elements in the order A B A B A B etc. Uses memory LAYOUT and visit elements in the order A A A B B B etc. Solve the above questions using the code below as reference: #include #include #include typedef struct fields are individual ints int a; int b; intfieldt; typedef struct fields are arrays of ints int aarr; int barr; arrfieldt; Use this format string for printf invocations so that the output identical for each timing run const char FORMAT "method: s CPU time: e sec sum: d
; sum computed in loop, should be each time CPU time computed over nested summing loops string describing one of the methods used to print; One of: "intfieldbase" "arrfieldbase" "intfieldoptm" "arrfieldoptm" Example: printfFORMAT "intfieldoptm", sometime, total; int mainint argc, char argv ifargc printfusage: s
argv; return ; int length atoiargv; int maxiter atoiargv; clockt begin, end; Variables for timing double cputime; int suma,sumb; sum of elements in structs intfieldbase approach intfieldt intfieldarr allocateinitialize intfield array mallocsizeofintfieldtlength; forint i; i
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
