Skip to content

Speedups#29

Merged
smaret merged 12 commits intolime-rt:masterfrom
allegroLeiden:master
Mar 30, 2015
Merged

Speedups#29
smaret merged 12 commits intolime-rt:masterfrom
allegroLeiden:master

Conversation

@allegroLeiden
Copy link
Copy Markdown
Contributor

(i) Replaced unnecessary calls to pow(), sqrt(), sin(), cos().
(ii) Introduced a test condition which fixes all the random seeds.
(iii) Increased the platform flexibility slightly.

systems. For qhull at least this is reflected in optional lines in the
Makefile; however it is a bit clunky to constantly have to hack this. Thus
I've added some lines to the Makefile which test the presence of an envar
ALLEGRO. This should be seen as a temporary solution: eventually we should
perhaps have a proper config script.
…ectives

at the start of grid.c and smooth.c.
… can set

a TEST flag at the compilation step which initializes the GSL random number
generators with fixed-value seeds, rather than using the output of time(0),
which however remains the default. This should make it easier to examine the
effect of ongoing code modifications because with fixed seeds, the output of
the program should not vary from one run to another.

The modifications were performed to the src/ files aux.c, grid.c, predefgrid.c
and raytrace.c.
…hem with simple products. Modules and (starting) line

numbers affected:

		aux.c:			line 306.
		getclosest.c:		line 36.
		grid.c:			lines 127, 211, 461.
		magfieldfit.c:		lines 175, 342, 348, 520.
		molint.c:		lines 100, 103.
		photon.c:		lines 74, 80, 163.
		raytrace.c:		line 145.
		report.c:		lines 39, 85.
		smooth.c:		lines 42, 71.
		sourcefunc.c:		lines 87, 90, 92.
		velospline.c:		line 43.
		writefits.c:		lines 103, 107.

The fits output looks unchanged.
…irly radically modified 2 nested loops to avoid unnecessary

calls to sqrt() and to have a more robust starting condition for finding the extrema of a list.
	aux.c:		added a warning when no lines.
	aux.c:		removed a bit of white space.
	curses.c:	#include "lime.h"
	curses.c:	remove unused argument specnumber from collpartmesg().
	grid.c:		fixed bug in which .neigh attribute of a struct grid, which is
a double pointer to struct grid, was malloc'd to the size of the struct, not a pointer
to the struct.
	grid.c:		pts[i].vps is now initialized to 0 at line 306.
	grid.c:		test pts[i].vps>0 with exit on failure at line 355.
	grid.c:		incorrect grid attribute mallocs fixed at line 458.
	photon.c:	fixed some inconsistent indenting and got rid of some
unnecessary whitespace.
	predefgrid.c:	incorrect grid attribute malloc fixed at line 47.
	ratraninput.c:	fixed bug at line 42 in which char was incremented rather than
its pointer.
	stateq.c:	fixed some inconsistent indenting.
	stateq.c:	Added an exception at line 102 for when m[ispec].nlev<=0.
 #
Please
enter
the commit message for your changes. Lines starting
	aux.c:85	Set the values of new attributes radiusSqu and minScaleSqu to inputPars.
	lime.h:58	Added new attributes radiusSqu and minScaleSqu to inputPars.
	grid.c, ratraninput.c, raytrace.c, smooth.c, stokesangles.c: replaced unnecessary calls to sqrt(), sin(), cos().
	getclosest.c:35
	grid.c:271
* I fixed some inconsistent indenting in smooth.c and velospline.c.
* The velocity() function in example/model.c should be much faster now!
- Made raytracing faster by moving the sine/cosine calculation outside the loop at line 113.
- Halved the number of calls to exp() in photon.photon() and photon.getjbar().
@smaret smaret self-assigned this Mar 26, 2015
@smaret
Copy link
Copy Markdown
Contributor

smaret commented Mar 30, 2015

A note on commit messages: a common practice for Git is to start the message with a short (50 char of less) description of the commit, followed by a more complete description of the changes, if needed. This makes the code changes easier to follow both on GitHub, and with the command line (git log --summary). For more information, see commit guidelines in the Pro Git book.

smaret added a commit that referenced this pull request Mar 30, 2015
@smaret smaret merged commit b410a60 into lime-rt:master Mar 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants