PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
async.c
Go to the documentation of this file.
1 
14 #include "common.h"
15 
16 #include <stdlib.h>
17 
18 /***************************************************************************/
21 int plasma_request_fail(PLASMA_sequence *sequence, PLASMA_request *request, int status)
22 {
23  sequence->request = request;
24  sequence->status = status;
25  request->status = status;
26  return status;
27 }
28 
29 /***************************************************************************/
33 {
34  if ((*sequence = malloc(sizeof(PLASMA_sequence))) == NULL) {
35  plasma_error("PLASMA_Sequence_Create", "malloc() failed");
37  }
38  if(((*sequence)->quark_sequence = QUARK_Sequence_Create(plasma->quark)) == NULL){
39  plasma_error("PLASMA_Sequence_Create", "QUARK_Sequence_Create() failed");
41  }
42  (*sequence)->status = PLASMA_SUCCESS;
43  return PLASMA_SUCCESS;
44 }
45 
46 /***************************************************************************/
50 {
51  QUARK_Sequence_Destroy(plasma->quark, sequence->quark_sequence);
52  free(sequence);
53  return PLASMA_SUCCESS;
54 }
55 
56 /***************************************************************************/
60 {
61  QUARK_Sequence_Wait(plasma->quark, sequence->quark_sequence);
62  return PLASMA_SUCCESS;
63 }
64 
65 /***************************************************************************/
68 void plasma_sequence_flush(Quark *quark, PLASMA_sequence *sequence, PLASMA_request *request, int status)
69 {
70  sequence->request = request;
71  sequence->status = status;
72  request->status = status;
73  QUARK_Sequence_Cancel(quark, sequence->quark_sequence);
74 }
75 
76 /***************************************************************************/
94 {
96  int status;
97 
98  plasma = plasma_context_self();
99  if (plasma == NULL) {
100  plasma_fatal_error("PLASMA_Sequence_Create", "PLASMA not initialized");
102  }
103  status = plasma_sequence_create(plasma, sequence);
104  return status;
105 }
106 
107 /***************************************************************************/
125 {
127  int status;
128 
129  plasma = plasma_context_self();
130  if (plasma == NULL) {
131  plasma_fatal_error("PLASMA_Sequence_Destroy", "PLASMA not initialized");
133  }
134  if (sequence == NULL) {
135  plasma_fatal_error("PLASMA_Sequence_Destroy", "NULL sequence");
136  return PLASMA_ERR_UNALLOCATED;
137  }
138  status = plasma_sequence_destroy(plasma, sequence);
139  return status;
140 }
141 
142 /***************************************************************************/
160 {
162  int status;
163 
164  plasma = plasma_context_self();
165  if (plasma == NULL) {
166  plasma_fatal_error("PLASMA_Sequence_Wait", "PLASMA not initialized");
168  }
169  if (sequence == NULL) {
170  plasma_fatal_error("PLASMA_Sequence_Wait", "NULL sequence");
171  return PLASMA_ERR_UNALLOCATED;
172  }
173  status = plasma_sequence_wait(plasma, sequence);
174  return status;
175 }
176 
177 /***************************************************************************/
198 {
200 
201  plasma = plasma_context_self();
202  if (plasma == NULL) {
203  plasma_fatal_error("PLASMA_Sequence_Flush", "PLASMA not initialized");
205  }
206  if (sequence == NULL) {
207  plasma_fatal_error("PLASMA_Sequence_Flush", "NULL sequence");
208  return PLASMA_ERR_UNALLOCATED;
209  }
210  plasma_sequence_flush(plasma->quark, sequence, request, PLASMA_ERR_SEQUENCE_FLUSHED);
211  return PLASMA_SUCCESS;
212 }