Submitted by:
Student Name: Yashwant Nagarjuna Kuppa
UFID: 7181-4301
No. of Group member(s): 1
mix run lib/proj1.ex arg1 arg2
time mix run lib/proj1.ex
For running the file for multiple outputs run the command mix clean
and then run for multiple outputs
============================================================
Size of the work unit.
I calculated the size of subproblem by trying various different values and I observed that optimal performance is obtained at sqrt(n)
number of processes.
Three module were created.
proj1.ex
-> This module takes in the user inputn
,k
and divides the work amongsqrt(n)
actors. These actors will be sent to the worker module to calculate the sum of the squares.worker.ex
-> This module calculates the sum of the squares and determines if it is a perfect square. The result is sent as a message to the scheduler module.scheduler.ex
-> This module takes the result from the worker module and kills the process after returning the result.
Work unit: Each actor gets sqrt(n)
range of numbers to operate upon.
================================================
Output for elixir
Project1 1000000 4
$ mix run lib/proj1.ex 1000000 4
Compiling three files (.ex)
$ time mix run lib/proj1.ex 1000000 4
real 0m2.572s
user 0m7.809s
sys 0m0.255s
CPU time = user time + sys time Hence, # cores used in the computation = CPU time/real time = 3.13
===========================================
The largest problem managed to solve
mix run lib/proj1.ex 100000000 4
The result is an empty list since there are no perfect squares for k = 4
===========================================