FAQ  •  Login

Project 2 - timing results

Moderator: RaduS

<<

RaduS

Jr. Member
Jr. Member

Posts: 97

Joined: Wed Aug 14, 2013 3:08 pm

Unread post Tue Nov 26, 2013 10:56 am

Project 2 - timing results

I'm curious to see how long your simulator takes to solve this problem.

As you complete your project, please run the dynamic simulation with the following settings:
  • simulation time: tend = 1 second
  • step-size: h=0.001
  • tolerance = 10-8 (This is the tolerance used as the Newton-Raphson stopping criteria in the implicit integrator)
Instrument your code (using the Matlab functions tic and toc) to measure the time required for the simulation (exclude the time required to read the model and analysis configuration from the ADM and ACF files) and post the elapsed time you obtain.

Thanks,
-Radu
<<

f13dfarley

Newbie
Newbie

Posts: 12

Joined: Wed Sep 04, 2013 3:47 pm

Unread post Tue Nov 26, 2013 1:43 pm

Re: Project 2 - timing results

Elapsed time is 4.622364 seconds.

-Danny Farley
<<

RaduS

Jr. Member
Jr. Member

Posts: 97

Joined: Wed Aug 14, 2013 3:08 pm

Unread post Tue Nov 26, 2013 5:51 pm

Re: Project 2 - timing results

f13dfarley wrote:Elapsed time is 4.622364 seconds.

-Danny Farley


Danny, looking at what you submitted on Learn@UW it seems to me that you've been using a tolerance of 1e-6. Please update your timing result for the specified tolerance of 1e-8.
Thanks,
-Radu

P.S. Your simulator is quite efficient!
<<

f13-759-parthiban

Newbie
Newbie

Posts: 8

Joined: Mon Sep 09, 2013 9:12 am

Unread post Tue Nov 26, 2013 5:58 pm

Re: Project 2 - timing results

Radu,

My code takes a long time to execute. The elapsed time is 77.668773 seconds. I had to reduce the tolerance to 1e-6 to bring it down to under ten sec in which case the elapsed time is 7.519872 seconds!

Are there any general suggestions to increase the speed? I use classes as my data sturcture. I wonder if that reduces the speed. My earlier kinematic analysis for project 1 dint take this long!

Thanks,
Chembian
Chembian
<<

f13wchoi26

Newbie
Newbie

Posts: 15

Joined: Wed Sep 04, 2013 3:47 pm

Unread post Tue Nov 26, 2013 6:46 pm

Re: Project 2 - timing results

h = 0.001;
Max_it = 10;
tol = 1e-8;
Elapsed time is 5.897157 seconds.

h = 0.001;
Max_it = 100;
tol = 1e-8;
Elapsed time is 37.516677 seconds.
WoongJo Choi
<<

RaduS

Jr. Member
Jr. Member

Posts: 97

Joined: Wed Aug 14, 2013 3:08 pm

Unread post Tue Nov 26, 2013 7:58 pm

Re: Project 2 - timing results

f13-759-parthiban wrote:My code takes a long time to execute. The elapsed time is 77.668773 seconds. I had to reduce the tolerance to 1e-6 to bring it down to under ten sec in which case the elapsed time is 7.519872 seconds!

Are there any general suggestions to increase the speed? I use classes as my data sturcture. I wonder if that reduces the speed. My earlier kinematic analysis for project 1 dint take this long!


Chembian,

Yes, I believe that using OOP in Matlab slows things down some. See for example the following discussion on StackOverflow:
http://stackoverflow.com/questions/1693429/is-matlab-oop-slow-or-am-i-doing-something-wrong
Having said that, OOP makes for much nicer and cleaner code, doesn't it?

You could try to use the Matlab profiler to identify bottlenecks in your code (help profile).

-Radu
<<

RaduS

Jr. Member
Jr. Member

Posts: 97

Joined: Wed Aug 14, 2013 3:08 pm

Unread post Tue Nov 26, 2013 8:14 pm

Re: Project 2 - timing results

f13wchoi26 wrote:h = 0.001;
Max_it = 10;
tol = 1e-8;
Elapsed time is 5.897157 seconds.

h = 0.001;
Max_it = 100;
tol = 1e-8;
Elapsed time is 37.516677 seconds.


WoongJo,

These results indicate that you need very often more than 10 iterations to converge the Newton iterations to within the prescribed tolerance. This doesn't seem quite right (at most time steps it should not take more than 3-4 iterations). Assuming you do get the correct results (when you don't stop the Newton loop after 10 iterations), you may want to double check your Jacobian calculation.

-Radu
<<

F13jlynne

Newbie
Newbie

Posts: 9

Joined: Thu Aug 29, 2013 3:46 pm

Unread post Wed Nov 27, 2013 2:24 am

Re: Project 2 - timing results

My elapsed time is 32.4961 seconds for 1e-8 tolerance.

Jenna
<<

F13thibault.12

Newbie
Newbie

Posts: 27

Joined: Thu Aug 29, 2013 3:46 pm

Unread post Wed Nov 27, 2013 5:57 pm

Re: Project 2 - timing results

My code runs "slidercrank" for jbar1 = 450, 900 in 7-9 seconds.

Matthew Thibault

P.S. Thanks for the assistance!
<<

RaduS

Jr. Member
Jr. Member

Posts: 97

Joined: Wed Aug 14, 2013 3:08 pm

Unread post Wed Nov 27, 2013 6:09 pm

Re: Project 2 - timing results

F13thibault.12 wrote:My code runs "slidercrank" for jbar1 = 450, 900 in 7-9 seconds.

Matthew Thibault

P.S. Thanks for the assistance!



Matthew,

So that we can compare apples to apples, I explicitly asked for the running time using a tolerance of 10-8. Looking at your code on Learn@UW, it seems you used 10-6, right?

Thanks,
-Radu
<<

F13thibault.12

Newbie
Newbie

Posts: 27

Joined: Thu Aug 29, 2013 3:46 pm

Unread post Wed Nov 27, 2013 10:29 pm

Re: Project 2 - timing results

Yes, my code does strange things if I tighten the tolerance any more. I forgot about that. Any suggestions why this might be?

I also noticed on the angular velocity vs time plot (flywheel), it seems that every cycle results in a decrease in the average angular velocity, I'm not sure why this would be. I expected it would be a steady state situation.

-Matthew
<<

F13fnmercado

Newbie
Newbie

Posts: 16

Joined: Thu Aug 29, 2013 3:46 pm

Unread post Wed Nov 27, 2013 10:57 pm

Re: Project 2 - timing results

Average of 3 runs:
  Code:
no output     plots only    plots and visualization
4.992189      5.703272      9.358151

approximately 3-4 actual iterations required (max=20)
tol = 1e-8
h = 0.001
tend = 1
Frankie
<<

RaduS

Jr. Member
Jr. Member

Posts: 97

Joined: Wed Aug 14, 2013 3:08 pm

Unread post Thu Nov 28, 2013 12:13 am

Re: Project 2 - timing results

F13thibault.12 wrote:Yes, my code does strange things if I tighten the tolerance any more. I forgot about that. Any suggestions why this might be?

I also noticed on the angular velocity vs time plot (flywheel), it seems that every cycle results in a decrease in the average angular velocity, I'm not sure why this would be. I expected it would be a steady state situation.

-Matthew


Maybe some bugs in the implementation of the piston force? Make sure that the force is zero whenever x3d<0, as well as when x3<1.5 or x3>5.5.

-Radu
<<

RaduS

Jr. Member
Jr. Member

Posts: 97

Joined: Wed Aug 14, 2013 3:08 pm

Unread post Thu Nov 28, 2013 12:14 am

Re: Project 2 - timing results

F13fnmercado wrote:Average of 3 runs:
  Code:
no output     plots only    plots and visualization
4.992189      5.703272      9.358151

approximately 3-4 actual iterations required (max=20)
tol = 1e-8
h = 0.001
tend = 1


That's pretty impressive Frankie! Nice job.
-Radu
<<

f13dfarley

Newbie
Newbie

Posts: 12

Joined: Wed Sep 04, 2013 3:47 pm

Unread post Mon Dec 02, 2013 1:59 pm

Re: Project 2 - timing results

Whoops, I forgot to change my tolerance.

Elapsed time is 15.730180 seconds.

-Danny

Return to ME451 Fall 2013: Kinematics and Dynamics of Machine Systems

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.