2 * Copyright 2008, 2009 David Hilvert <dhilvert@gmail.com>
4 * This file is part of libale.
6 * libale is free software: you can redistribute it and/or modify it under the
7 * terms of the GNU Affero General Public License as published by the Free
8 * Software Foundation, either version 3 of the License, or (at your option)
11 * libale is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
16 * You should have received a copy of the GNU Affero General Public License
17 * along with libale. If not, see <http://www.gnu.org/licenses/>.
28 TYPE_HOST(ale_context
, \
30 int compute_resident_size
; \
31 int host_resident_size
; \
32 int file_resident_size
;, \
33 clReleaseContext(P(this)->cc
);)
39 ale_context
ale_new_context(cl_context cc
) {
41 if (cc
== ((cl_context
) 0) || clRetainContext(cc
) != CL_SUCCESS
)
42 return N(ale_context
);
44 ale_context ac
= ale_context_alloc();
46 if (!ale_context_valid(ac
)) {
48 return N(ale_context
);
52 P(ac
)->compute_resident_size
= 0;
53 P(ac
)->host_resident_size
= 0;
54 P(ac
)->file_resident_size
= 0;
59 cl_context
ale_context_retain_cl(ale_context ac
) {
60 if (!ale_context_valid(ac
))
61 return ((cl_context
) 0);
63 clRetainContext(P(ac
)->cc
);
67 int ale_context_set_property(ale_context ac
, const char *name
, const char *value
) {
68 if (!strcmp(name
, "compute_resident_size")) {
69 P(ac
)->compute_resident_size
= atoi(value
);
70 } else if (!strcmp(name
, "host_resident_size")) {
71 P(ac
)->host_resident_size
= atoi(value
);
72 } else if (!strcmp(name
, "file_resident_size")) {
73 P(ac
)->file_resident_size
= atoi(value
);
75 return ALE_UNSPECIFIED_FAILURE
;