MAGMA  1.2.0
MatrixAlgebraonGPUandMulticoreArchitectures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
async.c File Reference
#include <stdlib.h>
#include "common.h"
Include dependency graph for async.c:

Go to the source code of this file.

Functions

int magma_request_fail (magma_sequence_t *sequence, magma_request_t *request, int status)
int magma_sequence_create (magma_context_t *magma, magma_sequence_t **sequence)
int magma_sequence_destroy (magma_context_t *magma, magma_sequence_t *sequence)
int magma_sequence_wait (magma_context_t *magma, magma_sequence_t *sequence)
int MAGMA_Sequence_Create (magma_sequence_t **sequence)
int MAGMA_Sequence_Destroy (magma_sequence_t *sequence)
int MAGMA_Sequence_Wait (magma_sequence_t *sequence)
int MAGMA_Sequence_Flush (magma_sequence_t *sequence, magma_request_t *request)

Function Documentation

int magma_request_fail ( magma_sequence_t sequence,
magma_request_t request,
int  status 
)

Register an exception.

Definition at line 21 of file async.c.

References magma_sequence_s::request, magma_request_s::status, and magma_sequence_s::status.

{
sequence->request = request;
sequence->status = status;
request->status = status;
return status;
}

Here is the caller graph for this function:

int magma_sequence_create ( magma_context_t magma,
magma_sequence_t **  sequence 
)

Create a sequence

Definition at line 32 of file async.c.

References MAGMA_ERR_OUT_OF_RESOURCES, magma_error, MAGMA_SUCCESS, and morse_sequence_create().

{
if ((*sequence = malloc(sizeof(magma_sequence_t))) == NULL) {
magma_error("MAGMA_Sequence_Create", "malloc() failed");
}
morse_sequence_create( magma, *sequence );
(*sequence)->status = MAGMA_SUCCESS;
return MAGMA_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int MAGMA_Sequence_Create ( magma_sequence_t **  sequence)

MAGMA_Sequence_Create - Create a squence.

Parameters:
[out]sequenceIdentifies a set of routines sharing common exception handling.
Returns:
Return values:
MAGMA_SUCCESSsuccessful exit

Definition at line 81 of file async.c.

References magma_context_self(), MAGMA_ERR_NOT_INITIALIZED, magma_fatal_error, and magma_sequence_create().

{
int status;
magma = magma_context_self();
if (magma == NULL) {
magma_fatal_error("MAGMA_Sequence_Create", "MAGMA not initialized");
}
status = magma_sequence_create(magma, sequence);
return status;
}

Here is the call graph for this function:

int magma_sequence_destroy ( magma_context_t magma,
magma_sequence_t sequence 
)

Destroy a sequence

Definition at line 48 of file async.c.

References MAGMA_SUCCESS, and morse_sequence_destroy().

{
morse_sequence_destroy( magma, sequence );
free(sequence);
return MAGMA_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int MAGMA_Sequence_Destroy ( magma_sequence_t sequence)

MAGMA_Sequence_Destroy - Destroy a sequence.

Parameters:
[in]sequenceIdentifies a set of routines sharing common exception handling.
Returns:
Return values:
MAGMA_SUCCESSsuccessful exit

Definition at line 112 of file async.c.

References magma_context_self(), MAGMA_ERR_NOT_INITIALIZED, MAGMA_ERR_UNALLOCATED, magma_fatal_error, and magma_sequence_destroy().

{
int status;
magma = magma_context_self();
if (magma == NULL) {
magma_fatal_error("MAGMA_Sequence_Destroy", "MAGMA not initialized");
}
if (sequence == NULL) {
magma_fatal_error("MAGMA_Sequence_Destroy", "NULL sequence");
}
status = magma_sequence_destroy(magma, sequence);
return status;
}

Here is the call graph for this function:

int MAGMA_Sequence_Flush ( magma_sequence_t sequence,
magma_request_t request 
)

MAGMA_Sequence_Flush - Terminate a sequence.

Parameters:
[in]sequenceIdentifies a set of routines sharing common exception handling.
[in]requestThe flush request.
Returns:
Return values:
MAGMA_SUCCESSsuccessful exit

Definition at line 185 of file async.c.

References magma_context_self(), MAGMA_ERR_NOT_INITIALIZED, MAGMA_ERR_SEQUENCE_FLUSHED, MAGMA_ERR_UNALLOCATED, magma_fatal_error, MAGMA_SUCCESS, morse_sequence_flush(), magma_context_s::quark, and magma_context_s::schedopt.

{
magma = magma_context_self();
if (magma == NULL) {
magma_fatal_error("MAGMA_Sequence_Flush", "MAGMA not initialized");
}
if (sequence == NULL) {
magma_fatal_error("MAGMA_Sequence_Flush", "NULL sequence");
}
morse_sequence_flush( (void *)magma->schedopt.quark, sequence, request, MAGMA_ERR_SEQUENCE_FLUSHED);
return MAGMA_SUCCESS;
}

Here is the call graph for this function:

int magma_sequence_wait ( magma_context_t magma,
magma_sequence_t sequence 
)

Wait for the completion of a sequence

Definition at line 58 of file async.c.

References MAGMA_SUCCESS, and morse_sequence_wait().

{
morse_sequence_wait( magma, sequence );
return MAGMA_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int MAGMA_Sequence_Wait ( magma_sequence_t sequence)

MAGMA_Sequence_Wait - Wait for the completion of a sequence.

Parameters:
[in]sequenceIdentifies a set of routines sharing common exception handling.
Returns:
Return values:
MAGMA_SUCCESSsuccessful exit

Definition at line 147 of file async.c.

References magma_context_self(), MAGMA_ERR_NOT_INITIALIZED, MAGMA_ERR_UNALLOCATED, magma_fatal_error, and magma_sequence_wait().

{
int status;
magma = magma_context_self();
if (magma == NULL) {
magma_fatal_error("MAGMA_Sequence_Wait", "MAGMA not initialized");
}
if (sequence == NULL) {
magma_fatal_error("MAGMA_Sequence_Wait", "NULL sequence");
}
status = magma_sequence_wait(magma, sequence);
return status;
}

Here is the call graph for this function: