| Author |
Message |
< Erlang ~ Simple floating-point lists operation hung Erlang system :( |
| copypastor |
Posted: Fri Nov 25, 2011 11:28 am |
|
|
|
Joined: 24 Nov 2011
Posts: 1
|
Hello people!
I'm new to Erlang and need someone's help solving issue with my sample/benchmarking code
I wrote simple benchmark code to measure floating-point Erlang performance. And seems that code gets Erlang system into a deadlock :-p
The thing is that my code doing VERY simple thing - it first generates big list of pairs of Euclidian vectors, then in loop performs sequential mult-add operation on each element.
When I start one such process per CPU core and list is big enough, the Erlang systems quickly stops responding.
The sample code is:
Code:
-module ( bug ).
-export ( [start/0] ).
-record ( vec3, { x=0, y=0, z=0 } ).
vec3ma( V0, V1, K ) when is_record( V0, vec3 ) and is_record( V1, vec3 ) and is_number( K ) ->
#vec3{ x = V0#vec3.x + V1#vec3.x * K, y = V0#vec3.y + V1#vec3.y * K, z = V0#vec3.z + V1#vec3.z * K }.
%create test data
makeVecTestList( L, 0 ) -> L;
makeVecTestList( L, N ) ->
E = { #vec3{ x = N * 10.0, y = 20.0, z = 30.0 }, #vec3{ x=10.0, y=20.0, z=-40.0 } },
makeVecTestList( [ E|L ], N - 1 ).
%Test list-processing code
proc( L ) -> proc( L, [] ).
proc( [], Acc ) -> Acc;
proc( [ { P, V } | T ], Acc ) -> proc( T, [ { vec3ma( P, V, 0.11 ), V } | Acc ] ).
%process loop
vecTestLoop( L, T, I ) ->
Now = now(),
DT = timer:now_diff( Now, T ) * 1.0e-3,
io:format( "Step~p: ~p ms\n", [I, DT] ),
vecTestLoop( proc( L ), Now, I ).
start() ->
L = makeVecTestList( [], 1000000 ),
io:format( "Running test with: ~p\n", [length(L)] ),
spawn( fun() -> vecTestLoop( L, now(), 1 ) end ),
spawn( fun() -> vecTestLoop( L, now(), 2 ) end ),
spawn( fun() -> vecTestLoop( L, now(), 3 ) end ),
spawn( fun() -> vecTestLoop( L, now(), 4 ) end ).
I used next test-cases:
AMD 64 2 core, 3.1 GHZ, Windows XP, Erlang R14B04:
- Works well with one process and any list that fits into memory
- Works well with two processes and list of 500000 elements
- Hangs in about 30-60 seconds with list of 750000 elements
- Hangs almost immediately with list of 1000000 elements
Intel Quad 2.67 GHz, Windows 7 x64, Erlang R14B04:
- Works well with one process and any list that fits into memory
- Hangs in about 30-60 seconds with list of 1000000 elements
- Hangs almost immediately with list of 1500000 elements
This looks very similar to deadlock - when iterations stops, the erl.exe cannot be stopped with Ctrl+C/Break, and starts to load ONLY ONE CORE. Though while he still alive, he consume all cores.
Memory consumption by erl.exe was about or even under 1 GB in all cases.
P.S. I know that Erlang is not good at crunching raw floating-point data. I just want to estimate, how bad thing are And/or compare tuple/list vec3 implementation.
My planned application supposed to process a small chunks of such data in event based manner.
Thanx and GL. |
|
|
| Back to top |
|
| baaa |
Posted: Fri Dec 09, 2011 3:52 am |
|
|
|
Guest
|
Welcome to visit our store online to find your favourite cheap uggs online. Our store has a large number of cheap uggs uk with
fashionable design. They all have high quality, which are made from top quality material. What's more, they all follow the latest fashion trend, so you will become more
fashionable with them. You can get them with cheapest price, and the quality is 100% guaranteed. You will find it is a wise decision to choose our cheap uggs, there is nothing
wrong for you to pick cheap uggs in our store.cheap designer *beep*’
prices may range from the very conservative $100 up to pretty much as high as the designer sees fit. The prices of the bags are supposed to correspond to the fine materials and
quality of craftsmanship that is incorporated into the production of the bag.wholesale designer *beep* are indeed easy
to get. In fact, you could buy replica *beep* on the Internet. Nowadays, replica watch mainly feature low prices and amazing quality. |
|
|
| Back to top |
|
| Amyhan |
Posted: Mon Dec 19, 2011 7:56 am |
|
|
|
Joined: 19 Dec 2011
Posts: 2
|
The Hermes *beep* materials are carefully selected to give the same look as the original ones. They mirror every detail of the genuine ones so much that it is hard for most people even the best trained eyes to tell them apart at first glances.Our website provides best Cheap Hermes Bags,which preference to different leather, color, dimension, hardware etc.Our website to provide the best quality, best price of Discount Hermes *beep*,buy more save more.In this modern and fashionable society, people are pursuing for Hermes *beep* us. Because Hermes bags are cool, unique, stylish and innovative. You could keep yourself fashionable and chic for this designer cheap Hermes bags.
Nowadays, Hermes Birkin 35cm *beep* are hot selling in many online stores. The entire Hermes *beep* replica is classic design elements with modern fashion feeling. so if you are wanna to get, buy nice Hermes *beep* for sale now. |
|
|
| Back to top |
|
| dongdongwu |
Posted: Thu Sep 20, 2012 5:56 am |
|
|
|
User
Joined: 19 Sep 2012
Posts: 236
|
His good friend Diane said: "Christian Louboutin Men Shoes was a magician, he make shoes is immediately put his female people with legs and advantage. He understands women wanted to do and can make them into beautiful Cinderella." Madonna often in its concert wearing Christian louboutin high heels , and some famous superstar like Angelina jolie, mariah Carey, beyonce Knowles, the famous Japanese singer YaYouMei Hamasaki helps Christian Louboutin Men Shoes set up its powerful position. The youngest customers will count Tom cruise's daughter sully cruz. Louboutin made for only a pair of handmade Christian Louboutin high heel Shoes! Want to be more fashion? Put on Christian Louboutin Outlet !
Candy colors of the chalaza high-heeled shoes with lolita type allure, set full finely gem blue "neon shoes" is to need to use "sexy" to describe. Each pair are worth careful appreciation of lithe and graceful fairy ludaoli, what kind of most let you move?Christian Louboutin Men Shoes that one brush red is always cannot resist the temptation, Christian Louboutin men outlet continue to use the days of high 8cm above slender heel proclaim the sexy and luxuriant. The bowknot on black pointed high-heeled shoes with sharp rivet concomitant, wild python met enchanting color printing grain, It is that pairs of high-heeled shoes lets Carrie more feminine flavour. Like Christian Louboutin for men her word. |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|