Universal Scalability Law for Delphi and FreePascal

Universal Scalability Law for Delphi and FreePascal version 3.22

Author: Amine Moulay Ramdane.

Email: aminer68@gmail.com

Description:

This program analyzes system performance data with the Universal Scalability Law, and it compiles with Delphi XE versions and Delphi tokyo and FreePascal.

You have to supply the performance data as a csv file format, please take a look at the supplied csv file called "data.csv", the first line of the names of the columns of the csv file must be commented by "#" character, the names of the columns are mandatory.

Just compile the usl.pas program and run it by executing it on the command prompt like this: usl data.csv

The Universal Scalability Law (USL) was developed by Dr. Neil J. Gunther. It can be used to analyze system performance data in order to learn more about the scalability limitations of the system.

Details are presented in the book *Guerrilla Capacity Planning*.

Authors of Universal Scalability Law website:

http://www.perfdynamics.com/

Please take a look at the source code in the zip file:

When you compile the usl.pas , please type this at the command prompt: usl data.csv

Here is the output of my program:

Peak number is: 449.188

Predicted scalability peak is: 18.434

Coefficient of determination R-squared is: 0.995

The peak number is the peak number of cores (look inside the csv file) that will give the Predicted scalability peak that is: 18.434X

I have included also usl_graph.exe and its source code, us_graph.exe will draw a graph of the predicted scalability of the USL law, please type at the commmand prompt:

usl_graph data.csv -g 5 449 -nlr

You have to give two parameters to the -g option, this will draw a graph with a step=d(x)=5 between two successive data points, and it will draw a graph up to the peak number that is x=449

You can save after that your graph to the clipboard and open the paint program on windows and save it after that. The -nlr option means that the problem will be solved with the mathematical nonlinear regression using the simplex method as a minimization, if you don't specify -nlr, the problem will be solved by default by the mathematical polynomial regression.

I have used a polynomial regression and i have done other approximations to find the predicted scalability peak when the derivative must equal an approximation of 0 and this when the USL coefficient beta equal 0. This is all about mathematics.

You have three options:

You can type at the command prompt: usl data.csv -p 20

the -p option will give you the scalability for the data point 20

and you can type at the command prompt: usl data.csv -d 0.2 10

the -d option will give you the derivative of the USL equation at delta(y)/delta(x)=0.2 (it must be between 0 and 1) with a step delta(x)=10 that will output a number and derivative of a secant or a derivative delta(y)/delta(x) to better optimize the criterion of the cost for a better QoS.

And you can type at the command prompt: usl data.csv -nlr

the -nlr option means that the problem will be solved with the mathematical nonlinear regression using the simplex method as a minimization, if you don't specify -nlr, the problem will be solved by default by the mathematical polynomial regression.

I will a little bit explain my USL program...

If you have took a look at this link:

https://cran.r-project.org/web/packages/usl/vignettes/usl.pdf

You will notice that the performance data for the raytracer in the link above is the same as the performance data inside the data.csv file inside my zip file of my USL software..

And as you have noticed in the link above the peak scalability number is at: 449 processors.

So if you run my program against this same performance data like this at the command prompt:

usl data.csv

So the output is of my program is:

--

Peak number is: 449.188

Predicted scalability peak is: 18.434

Coefficient of determination R-squared is: 0.995

--

So as you have noticed that the peak number that is the peak number of processors is: 449.188

this is the same result as the link above.

So my program is working correctly.

But this is not the end of the story..

You have to optimize the criterion of the cost for a better QoS, and for this i have supplied you with a second option called -d that you have to run for that, so you have to type at the command prompt:

usl data.csv -d 0.3 0.1

the 0.3 is the slope of the secant with a step 0.1, so since the step is 0.1 so this will approximate a derivative of the USL equation that equal 0.3, so here is the output of my program when you run it with -d 0.3 0.1:

--

Peak number is: 449.188

Predicted scalability peak is: 18.434

Coefficient of determination R-squared is: 0.995

The derivative of the USL equation at delta(y)/delta(x)=0.300

with a step delta(x)=0.100, gives a number and derivative of

a secant or a derivative delta(y)/delta(x) of: 16.600 and 0.300

--

So as you have noticed that a good approximation for the derivative of the USL equation will arrive at the 16.600 cores and this gives also a derivative of the secant that approximate the derivative of the USL equation.

So to optimize more the criterion of the cost for a better QoS, you have to choose a good delta(y)/delta(x) to optimize the criterion of the cost of your system and you have to balance better between the performance and the cost.

I have tested more my USL for Delphi and FreePascal and it is working perfectly. But to make it work best with multicores with the polynomial regression solver , you have to choose the first column of the number of cores of the csv to: 1,2,4,8,16 without going up to 32 and it will work ok, don't choose 1,2,3,4,5 because this can make the polynomial regression solver to fail to solve the problem, but with the efficient nonlinear regression solver, you can make the first column of the number of cores of the csv to: 1,2,3,4,5 cores, and it will work correctly and solve the problem, because the nonlinear regression solver is more efficient.

How can you be sure that my USL program for Delphi and FreePascal works correctly ?

Please take a look at this link:

https://cran.r-project.org/web/packages/usl/vignettes/usl.pdf

Notice the raytracer performance data, when they have analysed it, it gives a peak scalability at: 449

So try to run my program inside the zip against the the same raytracer performance data that you will find inside the data.csv file inside the zip, and this will give the same peak scalability at: 449.

So as you have noticed, my program is working for this performance data of the raytracer, so i think that you can be confident with my program.

I have included a 32 bit and 64 bit windows executables called usl.exe and usl_graph.exe inside the zip, please read the readme file to know how to use it, it is a very powerful tool.

Here is an important and free book about Universal Scalability Law (USL), read it to understand more what USL is all about, you can download it from this link:

https://www.vividcortex.com/resources/universal-scalability-law/

Now about the Beta and Alpha coefficients of USL:

Coefficient Alpha is: the contention

And

Coefficient Beta is: the coherency.

Contention and coherency are measured as the fraction of the sequential execution time. A value of 0 means that there is no effect on performance. A contention factor of 0.2, for instance, means that 20% of the sequential execution time cannot be parallelized. A coherency factor of 0.01 means that the time spent in the synchronization between each pair of processes is 1% of the sequential execution time.

You can go to download the zip files by clicking on the following web link:

https://drive.google.com/drive/folders/1f2N--uiY-lzbppOBr5SbZDjniS1MhCeI?usp=sharing

Language: FPC Pascal v2.2.0+ / Delphi 5+: http://www.freepascal.org/

Required FPC switches: -O3 -Sd

-Sd for delphi mode....

Required Delphi switches: -DMSWINDOWS -$H+ -DDelphi

Required Delphi XE-XE7 switch: -$H+ -DXE

For Delphi use -DDelphi

- Platform: Win32 ,Win64,Linux,OSX