Difference between revisions of "Lightning Adventures"

From CDOT Wiki
Jump to: navigation, search
(Mission Statement)
(Assignment 1)
Line 16: Line 16:
  
 
==Assignment 1==
 
==Assignment 1==
 +
 +
=== <u>Fluorescent Monte Carlo - Simulation of fluoresence in scattering medium</u> ===
 +
Attempted by: Stanley Tsang
 +
 +
Uses the Monte Carlo subroutine mcsub.c to simulate
 +
the penetration and escape of excitation light from a semi-infinite medium,
 +
the distribution and escape of fluorescence from a uniform fluorophore in the medium, and
 +
the distribution and escape of fluorescence from a localized heterogeneity in the medium.
 +
Monte Carlo process-based simulations generally respond very well to parallelization as the random input process consists of entirely independent iterations and thus can be run in parallel (in theory).
 +
 +
The project can be found here: http://omlc.ogi.edu/software/mc/mcfluor/index.html
 +
 +
My goal for this project will be to parallelize the mcsub() function in mcsubLIB.c.  The target function is quite long so I present a truncated version of the hotspot below:  Note that Nphotons is extremely large, at least 1e6.
 +
 +
<big><pre>
 +
 +
for (iphoton=1; iphoton<=Nphotons; iphoton++) {
 +
 +
    /* Print out progress for user if mcflag < 3 */
 +
    temp = (double)iphoton;
 +
    if ((PRINTOUT == 1) & (mcflag < 3) & (temp >= 100)) {
 +
        if (temp<1000) {
 +
            if (fmod(temp,100)==0) printf("%1.0f    photons\n",temp);
 +
            }
 +
        if (temp<10000) {
 +
            if (fmod(temp,1000)==0) printf("%1.0f    photons\n",temp);
 +
            }
 +
        else if (temp<100000) {
 +
            if (fmod(temp,10000)==0) printf("%1.0f    photons\n",temp);
 +
            }
 +
        else if (temp<1000000) {
 +
            if (fmod(temp,100000)==0) printf("%1.0f  photons\n",temp);
 +
            }
 +
        else if (temp<10000000) {
 +
            if (fmod(temp,1000000)==0) printf("%1.0f  photons\n",temp);
 +
            }
 +
        else if (temp<100000000) {
 +
            if (fmod(temp,10000000)==0) printf("%1.0f photons\n",temp);
 +
            }
 +
        }
 +
.
 +
.
 +
.
 +
.
 +
.
 +
for (ir=1; ir<=NR; ir++) {
 +
    r = (ir - 0.5)*dr;
 +
    temp += J[ir];    /* accumulate total escaped photon weight */
 +
    J[ir] /= 2.0*PI*r*dr*Nphotons;                /* flux density */
 +
    for (iz=1; iz<=NZ; iz++)
 +
        F[iz][ir] /= 2.0*PI*r*dr*dz*Nphotons*mua; /* fluence rate */
 +
    }
 +
 +
*Sptr = S = Rsptot/Nphotons;
 +
*Aptr = A = Atot/Nphotons;
 +
*Eptr = E = temp/Nphotons;
 +
 +
}
 +
</pre></big>

Revision as of 17:19, 5 October 2012

Lightning Adventures is a assembly of 3 DPS915 Students, working towards parallelizing an application using NVIDIA's parallel computing architecture, CUDA.


Mission Statement

Our focus is to each select a program that we think will benefit from being optimized for parallel heterogeneous computing on the CPU and GPU. We will accomplish our task by first determining and profiling an application that we have found.

Team Members

  • James Boelen
  • Raymond Hung
  • Stanley Tsang


Assignment 1

Fluorescent Monte Carlo - Simulation of fluoresence in scattering medium

Attempted by: Stanley Tsang

Uses the Monte Carlo subroutine mcsub.c to simulate the penetration and escape of excitation light from a semi-infinite medium, the distribution and escape of fluorescence from a uniform fluorophore in the medium, and the distribution and escape of fluorescence from a localized heterogeneity in the medium. Monte Carlo process-based simulations generally respond very well to parallelization as the random input process consists of entirely independent iterations and thus can be run in parallel (in theory).

The project can be found here: http://omlc.ogi.edu/software/mc/mcfluor/index.html

My goal for this project will be to parallelize the mcsub() function in mcsubLIB.c. The target function is quite long so I present a truncated version of the hotspot below: Note that Nphotons is extremely large, at least 1e6.


for (iphoton=1; iphoton<=Nphotons; iphoton++) {

    /* Print out progress for user if mcflag < 3 */
    temp = (double)iphoton;
    if ((PRINTOUT == 1) & (mcflag < 3) & (temp >= 100)) {
        if (temp<1000) {
            if (fmod(temp,100)==0) printf("%1.0f     photons\n",temp);
            }
        if (temp<10000) {
            if (fmod(temp,1000)==0) printf("%1.0f     photons\n",temp);
            }
        else if (temp<100000) {
            if (fmod(temp,10000)==0) printf("%1.0f    photons\n",temp);
            }
        else if (temp<1000000) {
            if (fmod(temp,100000)==0) printf("%1.0f   photons\n",temp);
            }
        else if (temp<10000000) {
            if (fmod(temp,1000000)==0) printf("%1.0f  photons\n",temp);
            }
        else if (temp<100000000) {
            if (fmod(temp,10000000)==0) printf("%1.0f photons\n",temp);
            }
        }
.
.
.
.
.
for (ir=1; ir<=NR; ir++) {
    r = (ir - 0.5)*dr;
    temp += J[ir];    /* accumulate total escaped photon weight */
    J[ir] /= 2.0*PI*r*dr*Nphotons;                /* flux density */
    for (iz=1; iz<=NZ; iz++)
        F[iz][ir] /= 2.0*PI*r*dr*dz*Nphotons*mua; /* fluence rate */
    }

*Sptr = S = Rsptot/Nphotons;
*Aptr = A = Atot/Nphotons;
*Eptr = E = temp/Nphotons;

}