mdcore  0.1.5
Defines | Functions | Variables
/home/pedro/work/mdcore/src/runner.c File Reference
#include "../config.h"
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <math.h>
#include <float.h>
#include <string.h>
#include <limits.h>
#include <sched.h>
#include "cycle.h"
#include "errs.h"
#include "fptype.h"
#include "lock.h"
#include "part.h"
#include "fifo.h"
#include "queue.h"
#include "cell.h"
#include "space.h"
#include "potential.h"
#include "engine.h"
#include "runner.h"

Defines

#define error(id)   ( runner_err = errs_register( id , runner_err_msg[-(id)] , __LINE__ , __FUNCTION__ , __FILE__ ) )

Functions

void runner_sort_descending (unsigned int *parts, int N)
 Sort the particles in descending order using QuickSort.
void runner_sort_ascending (unsigned int *parts, int N)
 Sort the particles in ascending order using QuickSort.
int runner_dispatcher (struct engine *e)
 This is the dispatcher that passes pairs to the individual #runners.
int runner_run_dispatch (struct runner *r)
 The runner's main routine.
int runner_run_cell (struct runner *r)
 The runner's main routine (for the Cell/BE SPU).
int runner_run_cell_tuples (struct runner *r)
 The runner's main routine (for the Cell/BE SPU, using tuples).
int runner_run_verlet (struct runner *r)
 The runner's main routine (for Verlet lists).
int runner_run_pairs (struct runner *r)
 The runner's main routine.
int runner_run_tuples (struct runner *r)
 The runner's main routine (celltuple model).
int runner_init_SPU (struct runner *r, struct engine *e, int id)
 Initialize the runner associated to the given engine and attach it to an SPU.
int runner_init (struct runner *r, struct engine *e, int id)
 Initialize the runner associated to the given engine.

Variables

int runner_err = runner_err_ok
unsigned int runner_rcount = 0
char * runner_err_msg [11]

Define Documentation

#define error (   id)    ( runner_err = errs_register( id , runner_err_msg[-(id)] , __LINE__ , __FUNCTION__ , __FILE__ ) )

Function Documentation

int runner_dispatcher ( struct engine e)

This is the dispatcher that passes pairs to the individual #runners.

Parameters:
rPointer to the engine in which the runners reside.
Returns:
runner_err_ok or <0 on error (see runner_err).
int runner_init ( struct runner r,
struct engine e,
int  id 
)

Initialize the runner associated to the given engine.

Parameters:
rThe runner to be initialized.
eThe engine with which it is associated.
idThe ID of this runner.
Returns:
runner_err_ok or < 0 on error (see runner_err).
int runner_init_SPU ( struct runner r,
struct engine e,
int  id 
)

Initialize the runner associated to the given engine and attach it to an SPU.

Parameters:
rThe runner to be initialized.
eThe engine with which it is associated.
idThe ID of this runner.
Returns:
runner_err_ok or < 0 on error (see runner_err).

If CELL is not defined, this routine will fail!

int runner_run_cell ( struct runner r)

The runner's main routine (for the Cell/BE SPU).

Parameters:
rPointer to the runner to run.
Returns:
runner_err_ok or <0 on error (see runner_err).

This is the main routine for the runner. When called, it enters an infinite loop in which it waits at the engine r->e barrier and, once having paSSEd, calls space_getpair until there are no pairs available.

Note that this routine is only compiled if CELL has been defined.

int runner_run_cell_tuples ( struct runner r)

The runner's main routine (for the Cell/BE SPU, using tuples).

Parameters:
rPointer to the runner to run.
Returns:
runner_err_ok or <0 on error (see runner_err).

This is the main routine for the runner. When called, it enters an infinite loop in which it waits at the engine r->e barrier and, once having paSSEd, calls space_gettuple until there are no tuples available.

Note that this routine is only compiled if CELL has been defined.

int runner_run_dispatch ( struct runner r)

The runner's main routine.

Parameters:
rPointer to the runner to run.
Returns:
runner_err_ok or <0 on error (see runner_err).

This is the main routine for the runner. When called, it enters an infinite loop in which it waits at the engine r->e barrier and, once having passed, it picks pairs out of its "in" fifo, processes them, and passes them to the "out" fifo, until a #runner_stop is received.

int runner_run_pairs ( struct runner r)

The runner's main routine.

Parameters:
rPointer to the runner to run.
Returns:
runner_err_ok or <0 on error (see runner_err).

This is the main routine for the runner. When called, it enters an infinite loop in which it waits at the engine r->e barrier and, once having paSSEd, calls space_getpair until there are no pairs available.

int runner_run_tuples ( struct runner r)

The runner's main routine (celltuple model).

Parameters:
rPointer to the runner to run.
Returns:
runner_err_ok or <0 on error (see runner_err).

This is the main routine for the runner. When called, it enters an infinite loop in which it waits at the engine r->e barrier and, once having passed, calls space_gettuple until there are no tuples available.

int runner_run_verlet ( struct runner r)

The runner's main routine (for Verlet lists).

Parameters:
rPointer to the runner to run.
Returns:
runner_err_ok or <0 on error (see runner_err).

This is the main routine for the runner. When called, it enters an infinite loop in which it waits at the engine r->e barrier and, once having passed, checks first if the Verlet list should be re-built and then proceeds to traverse the Verlet list cell-wise and computes its interactions.

void runner_sort_ascending ( unsigned int *  parts,
int  N 
)

Sort the particles in ascending order using QuickSort.

Parameters:
partsThe particle IDs and distances in compact form
NThe number of particles.

The particle data is assumed to contain the distance in the lower 16 bits and the particle ID in the upper 16 bits.

void runner_sort_descending ( unsigned int *  parts,
int  N 
)

Sort the particles in descending order using QuickSort.

Parameters:
partsThe particle IDs and distances in compact form
NThe number of particles.

The particle data is assumed to contain the distance in the lower 16 bits and the particle ID in the upper 16 bits.


Variable Documentation

The ID of the last error.

char* runner_err_msg[11]
Initial value:
 {
        "Nothing bad happened.",
    "An unexpected NULL pointer was encountered.",
    "A call to malloc failed, probably due to insufficient memory.",
    "An error occured when calling a space function.",
    "A call to a pthread routine failed.",
    "An error occured when calling an engine function.",
    "An error occured when calling an SPE function.",
    "An error occured with the memory flow controler.",
    "The requested functionality is not available." ,
    "An error occured when calling an fifo function." ,
    "Error filling Verlet list: too many neighbours."
        }
unsigned int runner_rcount = 0
 All Data Structures Files Functions Variables Typedefs Enumerator Defines