M
Michael Gorbach
I was asked this summer to write a monte carlo code to simulation
magnetic nanoparticles. For the nonphysicists, basicly it is a
simulation where most of the time is taken up by looping through each
pair in an array of 500 or so particles, in order to calculate
interaction potential. I wrote what i have so far in csharp because i
wanted to learn it and though it would give me some good experience. I
am now beginning to understand that .net and managed code in general
lags far behind performance wise. Eventually i am probably going to
have to port to c++, unmanaged, because the simulation code will need
to run on linux as well.
My question is this:
What can i do in my chsarp code right now to speed up the performance.
The main method that is run hundreds of times a second basicly involves
calculating a vector dot product (using my own vector class), and an
exponential. Would marking the method unsafe speed anything up>
magnetic nanoparticles. For the nonphysicists, basicly it is a
simulation where most of the time is taken up by looping through each
pair in an array of 500 or so particles, in order to calculate
interaction potential. I wrote what i have so far in csharp because i
wanted to learn it and though it would give me some good experience. I
am now beginning to understand that .net and managed code in general
lags far behind performance wise. Eventually i am probably going to
have to port to c++, unmanaged, because the simulation code will need
to run on linux as well.
My question is this:
What can i do in my chsarp code right now to speed up the performance.
The main method that is run hundreds of times a second basicly involves
calculating a vector dot product (using my own vector class), and an
exponential. Would marking the method unsafe speed anything up>