0% found this document useful (0 votes)
4 views

2025_ECL_535_HW3_ApproximateComputing

The document outlines Homework 3 for ECL-535 at IIT Roorkee, focusing on approximate data-deduplication, iterative refinement strategies, and energy consumption in DRAM. It includes coding tasks, error calculations, and comparisons of algorithm performance under varying conditions. Additionally, it provides specific programming assignments and data analysis related to clustering and Monte Carlo simulations.

Uploaded by

nitin82919
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

2025_ECL_535_HW3_ApproximateComputing

The document outlines Homework 3 for ECL-535 at IIT Roorkee, focusing on approximate data-deduplication, iterative refinement strategies, and energy consumption in DRAM. It includes coding tasks, error calculations, and comparisons of algorithm performance under varying conditions. Additionally, it provides specific programming assignments and data analysis related to clustering and Monte Carlo simulations.

Uploaded by

nitin82919
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ECL-535 (Homework 3) 2025

ECE Department, IIT Roorkee

All the files required for executing the code have been uploaded in
FilesForHomeworks folder on teams.

1) We perform approximate data-deduplication such that while comparing two


elements, least significant bit (LSB) is ignored. For example, A910 and A911 are
considered same, since binary representations of 0x0 (0000) and 0x1 (0001) differ in
LSB only and other nibbles (0xA, 0x9, 0x1) are same. Similarly, BC79 and BC78 are
considered same. But, BC7A and BC78 are not considered same. Also, BC97 and
BC87 are not considered same. Now, under this strategy, will 16890E and 16890D
be considered as same or different? Explain your answer. (2 marks)

2) The data-values stored in a buffer with 4-rows and 4-columns is shown below (all
values in hexadecimal).( 4 marks)

AB9872 C9010B 7AE145 AB9872


16890E 881122 D80977 919717
D80977 713545 AB9873 7AE145
C9010C 919717 112233 16890D

We perform approximate data-deduplication such that while comparing two


elements, least significant bit (lsb) is ignored. For example, A910 and A911 are
considered same, since binary representations of 0x0 (0000) and 0x1 (0001) differ in
LSB only and other nibbles (0xA, 0x9, 0x1) are same. Similarly, BC79 and BC78 are
considered same. But, BC7A and BC78 are not considered same.
Also, BC97 and BC87 are not considered same.

To help you, Table below shows the translation.

Decimal Binary Hexadecimal


10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
If we use above technique, find the value of (Number Of Elements Before
Deduplication/Number Of Elements After Deduplication. )
(No partial marking. 0.5 marks for numerator and 3.5 marks for denominator. )

3) Consider the below code. (3 marks)

constint N=9;

float Arr[N], oldArr[N];

for (inti=0; i<N; i++) {

oldArr[i] = 0.2*i;

Arr[0] = 5;

for (inti = 1; i< N; i++) {

Arr[i] = (Arr[i-1]+oldArr[i]) ;

In the above code, we replace the second for loop with the below loop.

for (inti = 1; i< N; i+=2) {

Arr[i] = (Arr[i-1]+oldArr[i]);

Arr[i+1] = (Arr[i-1]+oldArr[i+1]);

You may use an online C++ IDE (e.g., https://www.programiz.com/cpp-


programming/online-compiler/) to run the code or your may evaluate its output
manually.

a) For Arr[7] the correct value is?

b) For Arr[7] approximate code gives a value of?

c) For Arr[8] approximate code gives a value of?


4. [3 marks] Consider an iterative refinement strategy, which we are applying on 6
points. Their initial errors are [80, 40, 30, 100, 15, 160]. In each iteration, the error
reduces to half.

A point converges when its error has reached <=1.0

TotalIteration = sum of iterations performed by all points.

For example, if 10 points do 8 iterations each, then TotalIteration is 80.

(a) Baseline strategy stops only when all the points have converged. Find
TotalIteration for this strategy [1 mark]

(b) We use a convergence-based strategy, where a point already converged is


excluded from further iterations. Find TotalIteration for this strategy. [2
mark]
5. [total 3 marks] Consider a DRAM with 65536 rows where 1/4 of the rows are
refreshed at normal rate (once every 64ms) and remaining rows are refreshed at
half rate (once every 128ms). Then, critical data are mapped only to rows refreshed
at normal rate. If refreshing a single row takes E nano Joule of energy, find the
energy consumed in 5120ms [2 mark]. Also compare it with baseline where all rows
are refreshed at normal rate. [1 mark]

6. (1+1 mark) To see how the scope of applying approximate computing depends on
the input, run ImageNearbyPixelDiff.cpp on two images: CrowdedCity.jpg and
SkyPhoto.jpeg. Write the value of its output (diff) for each case. For detailed
instructions, see the top lines of the file ImageNearbyPixelDiff.cpp

6. See Kmeans_Final.cpp.

(a) We discussed that “in clustering algorithm, only relative distances matter, not
absolute distances.”

In function "int getIDNearestCenter(Point point)", suppose we replace

min_dist = sqrt(sum); ==> min_dist = sum;

and
dist = sqrt(sum); ==> dist = sum;

Do we still get correct result? Explain the reason in 1 sentence. [2 mark]

(b) To change the maximum number of iterations, you need to change the fourth
parameter in the first line of DataSet.txt, as follows:

1000 4 30 100 1 

1000 4 30 1000 1

Now, run the program with 34 iterations. You can see that for this dataset, all
points converge at 33 iterations. The cluster to which each point is assigned is
printed in ResultsPointWiseK.txt, where K refers to maximum number of iterations
we specified.

Now, you have to run with less than 34 iterations and observe that less points
converge for less number of iterations. You can compare ResultsPointWiseK1.txt for
certain number of iterations (K1) with ResultsPointWise34.txt to see how many
points have not converged by end of K1 iterations. Call it NumPointsNotConverged

Hint: To find the number of lines that are different in two files, you can use
following command.

$awk 'NR==FNR{a[FNR]=$0;next}$0!=a[FNR]{print}'
ResultsPointWiseK1.txt ResultsPointWise34.txt | wc -l

Fill a to f in the table below by using above command. Then, compute difference in
third column. What is your conclusion from “difference” column? [6 marks]

max_iterations NumPointsNotConverged Difference

34 0

30 a= a-0 =

25 b= b-a =

20 c= c-b =

15 d= d-c =
10 e= e-d =

5 f= f-e =

7. See FindingPi_MonteCarlo.cpp. Run it for N=100,000 and N=10,000. Show the


value of pi. Now, implement perforation by 2 (i.e., i+=2) and then show values of pi
for above values of N. [2 marks]

8. Run NewtonRaphson_EarlyTermination.cpp and NewtonRaphson_Original.cpp


and report answer in the following table.

Root value
Iteration Original.cpp EarlyTermination.cpp
1
2
….

You might also like