Lizard - Script language for symbolic calculations, arbitrary large and precise numbers, parallel computing and more

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
jack
Addict
Addict
Posts: 1336
Joined: Fri Apr 25, 2003 11:10 pm

Re: Lizard - Script language for symbolic calculations, arbitrary large and precise numbers and more

Post by jack »

thabk you :)
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Lizard - Script language for symbolic calculations, arbitrary large and precise numbers and more

Post by STARGÅTE »

Dear all,

after the bug-fix update from the last time, now I want to share a new feature update.
________________________________________
Lizard - Symbolic computation script language (Version 0.4.4-0002)
Contains the Lizard.dll (Windows x64 and x86), the Lizard.so (Linux x64), the Lizard.pbi, some examples for the integration in Pure Basic and a detailed documentation for Lizard with many examples.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
The new feature gives you the opportunity to run calculations on multiple cores at the same time, which is the first step towards "parallel computing".
Following my principle of handling everything very easy in Lizard, there will be a simply "parallel" version for a few commands, which automatically creates a thread pool, distributes the calculations there, collects the normal results and returns it, without the user having to worry about anything.

An example:
While "Iterate(f(x), {x, 1, 1000})" executes a time-consuming function f sequentially on only one core, "IterateParallel(f(x), {x, 1, 1000})" distributs this calculation automatically on many cores (threads). Depending on the ratio of the actual calculation time to the time required for the thread management stuff, the overall execution time is usually significantly faster. Of course, this does not fit to simple functions, where parallelization is a disadvantage.

An overview of the new parallel computing functions with examples can be found here:Lizard » Core Language » Parallel Computing
Please keep in mind that you can put any Lizard function into a e.g. parallel iteration, to spread them to multiple cores.

Besides, there are a few other new functions like reciprocal trigonometric and hyperbolic functions, some other mathematical functions, again a few bug fixes and I put function plots for numerical functions in the documentation. Lizard » History

So, have fun while testing these features and I will appreciate your feedback.

Edit: Hot-fix 0.4.4-0002
Last edited by STARGÅTE on Sun Aug 28, 2022 6:40 pm, edited 1 time in total.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
jack
Addict
Addict
Posts: 1336
Joined: Fri Apr 25, 2003 11:10 pm

Re: Lizard - Script language for symbolic calculations, arbitrary large and precise numbers, parallel computing and more

Post by jack »

Hello STARGÅTE :)
if I run my FreeBasic example here's what I get, if I repeatedly enter the expression IterateParallel(f(x), {x, 1, 10000})

Code: Select all

-> IterateParallel(f(x), {x, 1, 10000})
elapsed time  0.8843369000005623 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time  0.8588957000010851 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time  0.8535100999997667 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time  0.8651286999993317 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time  0.8615126999993663 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time  1.376355700000204 seconds
-> IterateParallel(f(x), {x, 1, 10000})
elapsed time  15.84586130000025 seconds
Last edited by jack on Tue Aug 30, 2022 2:33 pm, edited 1 time in total.
User avatar
STARGÅTE
Addict
Addict
Posts: 2067
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Lizard - Script language for symbolic calculations, arbitrary large and precise numbers, parallel computing and more

Post by STARGÅTE »

Dear Jack,

I assume, you haven't define a function for f? So accually, you just create a large expression like:
"{f(1), f(2), f(3), f(4), ..., f(9999), f(10000)}" without any evaluation.
This means, no parallization is possible.

Let's try the following. Here, a function f is a function which needs ~10ms for evaluation:

Code: Select all

In(1)   :=  f(x?) := Pause(0.01)
                                                    evaluation time:    0.067ms
In(2)   :=  Iterate(f(x), {x, 1, 100});
                                                    evaluation time: 1058.806ms
In(3)   :=  IterateParallel(f(x), {x, 1, 100});
                                                    evaluation time:  144.861ms
Regarding the increase of time: You should use Lizard_FreeExpression(Expression) after you output them to release the memory. Otherwise, all expressions keep in memory.
However, I'm wondering, why the evaluation time increases at a certain evaluation rapidly.
I can confirm such behavior, when I print the all the results. It has nothing to do with the parallel computing. I have to check.

Edit: I have found the issue. The String-Return from the DLL was "wrong".
Lizard - Symbolic computation script language (Version 0.4.4-0002)
Last edited by STARGÅTE on Sun Aug 28, 2022 6:42 pm, edited 1 time in total.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Post Reply