swps3
DynProgr_PPU.c File Reference

PPU frontend to the alignment routines on the SPU. More...

#include <stdio.h>
#include <malloc.h>
#include <libspe2.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <errno.h>
#include "DynProgr_SPE.h"
#include <string.h>
#include <stdbool.h>
#include <ctype.h>
#include <limits.h>
#include <time.h>
#include <math.h>
#include <float.h>
#include <assert.h>
#include "debug.h"
#include "swps3.h"
#include "matrix.h"
#include "DynProgr_scalar.h"
#include "DynProgr_PPU.h"
#include "DynProgr_PPU_profile.inc"
Include dependency graph for DynProgr_PPU.c:

Go to the source code of this file.

Macros

#define MAX(a, b)   (a>b?a:b)
 
#define MIN(a, b)   (a<b?a:b)
 
#define T   int8_t
 
#define T   int16_t
 
#define T   float
 

Functions

static int SPEAlign (const char *db, int dbLen, double *result)
 
static int SPECreateProfile (const char *query, int queryLen, const void *matrix, double min, double max)
 Creates a profile in the SPE's memory.
 
static int SPEGetProfile (const SPEProfile *profile)
 
static int SPEInit (int dataType, int maxDbLen, Options *options)
 Initializes a SPE.
 
static int SPEPutProfile (void *profile, int *blockSize)
 
static int submitSPECommand (SPECommand *command)
 Sends a SPECommand to the SPE.
 
EXPORT double swps3_alignmentByteSPE (const SBMatrix matrix, const char *query, int queryLen, const char *db, int dbLen, Options *options)
 
EXPORT double swps3_alignmentFloatSPE (const SBMatrix matrix, const char *query, int queryLen, const char *db, int dbLen, Options *options)
 
EXPORT double swps3_alignmentProfileSPE (const char *db, int dbLen)
 Profile must have been loaded before!
 
EXPORT double swps3_alignmentShortSPE (const SBMatrix matrix, const char *query, int queryLen, const char *db, int dbLen, Options *options)
 
EXPORT SPEProfileswps3_createProfileBytePPU (const char *query, int queryLen, const SBMatrix matrix, int maxDbLen)
 
EXPORT SPEProfileswps3_createProfileFloatPPU (const char *query, int queryLen, const SBMatrix matrix, int maxDbLen)
 
EXPORT SPEProfileswps3_createProfileShortPPU (const char *query, int queryLen, const SBMatrix matrix, int maxDbLen)
 
EXPORT void swps3_freeProfilePPU (SPEProfile *profile)
 
EXPORT void swps3_loadProfileByte (SPEProfile *profile, int maxDbLen, Options *options)
 
EXPORT void swps3_loadProfileFloat (SPEProfile *profile, int maxDbLen, Options *options)
 
EXPORT void swps3_loadProfileShort (SPEProfile *profile, int maxDbLen, Options *options)
 

Variables

static spe_context_ptr_t spe_context = NULL
 
spe_program_handle_t spe_dynprogr_handle
 

Detailed Description

PPU frontend to the alignment routines on the SPU.

Definition in file DynProgr_PPU.c.

Macro Definition Documentation

#define MAX (   a,
 
)    (a>b?a:b)
#define MIN (   a,
 
)    (a<b?a:b)
#define T   int16_t

Definition at line 372 of file DynProgr_PPU.c.

#define T   float

Definition at line 372 of file DynProgr_PPU.c.

Function Documentation

static int SPEAlign ( const char *  db,
int  dbLen,
double *  result 
)
static
static int SPECreateProfile ( const char *  query,
int  queryLen,
const void *  matrix,
double  min,
double  max 
)
static

Creates a profile in the SPE's memory.

Parameters
queryThe query sequence.
queryLenThe length of the query sequence.
matrixThe scoring matrix with entries of the same type as specified in the SPEInit command.
minThe highest value in the scoring matrix.
maxThe lowest value in the scoring matrix.
See Also
SPEInit()
Returns
Nonzero on error.

Definition at line 157 of file DynProgr_PPU.c.

References __ALIGNED__, max, min, SPE_CMD_CREATE_PROFILE, and submitSPECommand().

Referenced by swps3_alignmentByteSPE(), swps3_alignmentFloatSPE(), and swps3_alignmentShortSPE().

static int SPEGetProfile ( const SPEProfile profile)
static
static int SPEInit ( int  dataType,
int  maxDbLen,
Options options 
)
static

Initializes a SPE.

Parameters
dataTypeThe data type for the computation. Must be one of SPE_ALIGNMENT_TYPE_DOUBLE, SPE_ALIGNMENT_TYPE_FLOAT, SPE_ALIGNMENT_TYPE_INT, SPE_ALIGNMENT_TYPE_SHORT, SPE_ALIGNMENT_TYPE_BYTE.
maxDbLenMaximal possible length of the database sequence.
optionsProgram options.
Returns
Nonzero on error.

Definition at line 132 of file DynProgr_PPU.c.

References __ALIGNED__, Options::gapExt, Options::gapOpen, maxDbLen, SPE_CMD_INIT, and submitSPECommand().

Referenced by swps3_alignmentByteSPE(), swps3_alignmentFloatSPE(), swps3_alignmentShortSPE(), swps3_loadProfileByte(), swps3_loadProfileFloat(), and swps3_loadProfileShort().

static int SPEPutProfile ( void *  profile,
int *  blockSize 
)
static

Definition at line 182 of file DynProgr_PPU.c.

References __ALIGNED__, SPE_CMD_PUT_PROFILE, and submitSPECommand().

static int submitSPECommand ( SPECommand command)
static

Sends a SPECommand to the SPE.

Parameters
commandA SPEcommand.
Returns
Returns nonzero on error.

Definition at line 105 of file DynProgr_PPU.c.

References spe_dynprogr_handle.

Referenced by SPEAlign(), SPECreateProfile(), SPEGetProfile(), SPEInit(), and SPEPutProfile().

EXPORT double swps3_alignmentByteSPE ( const SBMatrix  matrix,
const char *  query,
int  queryLen,
const char *  db,
int  dbLen,
Options options 
)
EXPORT double swps3_alignmentFloatSPE ( const SBMatrix  matrix,
const char *  query,
int  queryLen,
const char *  db,
int  dbLen,
Options options 
)
EXPORT double swps3_alignmentProfileSPE ( const char *  db,
int  dbLen 
)

Profile must have been loaded before!

Definition at line 314 of file DynProgr_PPU.c.

References SPEAlign().

Referenced by main().

EXPORT double swps3_alignmentShortSPE ( const SBMatrix  matrix,
const char *  query,
int  queryLen,
const char *  db,
int  dbLen,
Options options 
)
EXPORT SPEProfile* swps3_createProfileBytePPU ( const char *  query,
int  queryLen,
const SBMatrix  matrix,
int  maxDbLen 
)

Definition at line 359 of file DynProgr_PPU.c.

Referenced by main().

EXPORT SPEProfile* swps3_createProfileFloatPPU ( const char *  query,
int  queryLen,
const SBMatrix  matrix,
int  maxDbLen 
)

Definition at line 373 of file DynProgr_PPU.c.

Referenced by main().

EXPORT SPEProfile* swps3_createProfileShortPPU ( const char *  query,
int  queryLen,
const SBMatrix  matrix,
int  maxDbLen 
)

Definition at line 366 of file DynProgr_PPU.c.

Referenced by main().

EXPORT void swps3_freeProfilePPU ( SPEProfile profile)

Definition at line 379 of file DynProgr_PPU.c.

References SPEProfile::addr.

Referenced by main().

EXPORT void swps3_loadProfileByte ( SPEProfile profile,
int  maxDbLen,
Options options 
)

Definition at line 325 of file DynProgr_PPU.c.

References error(), SPE_DATA_INT8, SPEGetProfile(), and SPEInit().

Referenced by main().

EXPORT void swps3_loadProfileFloat ( SPEProfile profile,
int  maxDbLen,
Options options 
)

Definition at line 347 of file DynProgr_PPU.c.

References error(), SPE_DATA_FLOAT, SPEGetProfile(), and SPEInit().

EXPORT void swps3_loadProfileShort ( SPEProfile profile,
int  maxDbLen,
Options options 
)

Definition at line 336 of file DynProgr_PPU.c.

References error(), SPE_DATA_INT16, SPEGetProfile(), and SPEInit().

Referenced by main().

Variable Documentation

spe_context_ptr_t spe_context = NULL
static

Definition at line 97 of file DynProgr_PPU.c.

spe_program_handle_t spe_dynprogr_handle

Referenced by submitSPECommand().