PLASMA
2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
Main Page
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
allocate.c
Go to the documentation of this file.
1
14
#include "
common.h
"
15
#include "
allocate.h
"
16
#include "
auxiliary.h
"
17
18
#include <stdlib.h>
19
20
/***************************************************************************/
23
void
*
plasma_shared_alloc
(
plasma_context_t
*
plasma
,
size_t
size,
int
type)
24
{
25
void
*memptr;
26
27
size *=
plasma_element_size
(type);
28
if
(size <= 0)
29
return
NULL;
30
//if (posix_memalign(&memptr, STANDARD_PAGE_SIZE, size) != 0) {
31
if
((memptr = malloc(size)) == NULL) {
32
plasma_error
(
"plasma_shared_alloc"
,
"posix_memalign() failed"
);
33
return
NULL;
34
}
35
return
memptr;
36
}
37
38
/***************************************************************************/
41
void
plasma_shared_free
(
plasma_context_t
*
plasma
,
void
*ptr)
42
{
43
if
(ptr == NULL)
// somewhat redundant - free() does the same
44
return
;
45
free(ptr);
46
}
47
48
/***************************************************************************/
51
void
*
plasma_private_alloc
(
plasma_context_t
*
plasma
,
size_t
size,
int
type)
52
{
53
void
*memptr;
54
55
size *=
plasma_element_size
(type);
56
if
(size <= 0)
57
return
NULL;
58
//if (posix_memalign(&memptr, CACHE_LINE_SIZE, size) != 0) {
59
if
((memptr = malloc(size)) == NULL) {
60
plasma_error
(
"plasma_private_alloc"
,
"posix_memalign() failed"
);
61
return
NULL;
62
}
63
return
memptr;
64
}
65
66
/***************************************************************************/
69
void
plasma_private_free
(
plasma_context_t
*
plasma
,
void
*ptr)
70
{
71
if
(ptr == NULL)
// somewhat redundant - free() does the same
72
return
;
73
free(ptr);
74
}
plasma_2.4.5
control
allocate.c
Generated on Mon Jul 9 2012 12:44:58 for PLASMA by
1.8.1