Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
argo
aml
Commits
0827bffb
Commit
0827bffb
authored
Oct 02, 2020
by
Swann Perarnau
Browse files
Merge branch 'shell-pin-pkgs' into 'staging'
[ci] vendor Nix packaging See merge request
!162
parents
48a6b5c7
084fb7e7
Pipeline
#11484
passed with stages
in 4 minutes and 36 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
default.nix
0 → 100644
View file @
0827bffb
{
nixpkgs
?
builtins
.
fetchTarball
"https://github.com/NixOS/nixpkgs/archive/20.03.tar.gz"
}:
let
pkgs
=
import
nixpkgs
{
overlays
=
[
(
_
:
pkgs
:
{
doxygen
=
pkgs
.
doxygen
.
overrideAttrs
(
old
:
rec
{
name
=
"doxygen-1.8.14"
;
src
=
pkgs
.
fetchurl
{
urls
=
[
"mirror://sourceforge/doxygen/
${
name
}
.src.tar.gz"
"http://doxygen.nl/files/
${
name
}
.src.tar.gz"
];
sha256
=
"0XV+AnVe9vVv1F8fQ5hZi5IDgZSNb8+lj1ymqlb1nU0="
;
};
});
hwloc
=
pkgs
.
hwloc
.
overrideAttrs
(
old
:
{
name
=
"hwloc-2"
;
src
=
pkgs
.
fetchurl
{
url
=
"https://download.open-mpi.org/release/hwloc/v2.1/hwloc-2.1.0.tar.gz"
;
sha256
=
"0mdqa9w1p6cmli6976v4wi0sw9r4p5prkj7lzfd1877wk11c9c73"
;
};
});
aml
=
let
f
=
{
stdenv
,
src
,
autoreconfHook
,
pkgconfig
,
numactl
,
hwloc
}:
stdenv
.
mkDerivation
{
src
=
./.
;
name
=
"aml"
;
nativeBuildInputs
=
[
autoreconfHook
pkgconfig
];
buildInputs
=
[
hwloc
numactl
];
};
in
pkgs
.
lib
.
callPackageWith
pkgs
f
{
};
})
];
};
in
pkgs
shell.nix
View file @
0827bffb
# development shell, includes aml dependencies and dev-related helpers
# defined by argopkgs nix pkg record
{
pkgs
?
import
(
builtins
.
fetchTarball
"https://xgitlab.cels.anl.gov/argo/argopkgs/-/archive/master/argopkgs-master.tar.gz"
)
{}
}:
{
pkgs
?
import
./.
{
}
}:
with
pkgs
;
pkgs
.
mkShell
{
name
=
"aml"
;
nativeBuildInputs
=
[
autoreconfHook
pkgconfig
];
buildInputs
=
[
# dependencies for the code
hwloc
numactl
# deps for docs
graphviz
doxygen
python3Packages
.
sphinx
python3Packages
.
breathe
python3Packages
.
sphinx_rtd_theme
# deps for debug
gdb
valgrind
# style checks
(
clang-tools
.
override
(
o
:{
llvmPackages
=
pkgs
.
llvmPackages_7
;}))
llvmPackages_7
.
clang-unwrapped
.
python
];
CFLAGS
=
"-std=c99 -pedantic -Wall -Wextra -Werror -Wno-unused-but-set-parameter -Wno-builtin-declaration-mismatch"
;
mkShell
{
inputsFrom
=
[
aml
];
nativeBuildInputs
=
[
autoreconfHook
pkgconfig
];
buildInputs
=
[
# deps for docs
graphviz
doxygen
python3Packages
.
sphinx
python3Packages
.
breathe
python3Packages
.
sphinx_rtd_theme
# deps for debug
gdb
valgrind
# style checks
(
clang-tools
.
override
(
o
:
{
llvmPackages
=
llvmPackages_7
;
}))
llvmPackages_7
.
clang-unwrapped
.
python
];
CFLAGS
=
"-std=c99 -pedantic -Wall -Wextra -Werror -Wno-unused-but-set-parameter -Wno-builtin-declaration-mismatch"
;
}
src/area/cuda.c
View file @
0827bffb
...
...
@@ -78,7 +78,7 @@ int aml_area_cuda_mmap_opts(void **out,
const
size_t
size
,
const
int
device
,
const
int
flags
,
void
**
ptr_map
)
{
int
current_device
;
int
current_device
=
-
1
;
int
error
=
AML_SUCCESS
;
int
cuda_flags
;
...
...
src/area/hwloc.c
View file @
0827bffb
...
...
@@ -8,6 +8,8 @@
* SPDX-License-Identifier: BSD-3-Clause
******************************************************************************/
#include
"config.h"
#include
<sys/mman.h>
#include
"aml.h"
...
...
@@ -361,18 +363,15 @@ static int aml_hwloc_distances_alloc(const hwloc_obj_type_t t0,
n
=
*
nt0
+
*
nt1
;
}
*
out
=
malloc
(
sizeof
(
**
out
));
*
out
=
AML_INNER_MALLOC_EXTRA
(
n
,
hwloc_obj_t
,
n
*
n
*
sizeof
(
*
((
*
out
)
->
values
)),
struct
hwloc_distances_s
);
if
(
*
out
==
NULL
)
return
-
AML_ENOMEM
;
(
*
out
)
->
objs
=
malloc
(
n
*
sizeof
(
hwloc_obj_t
));
if
((
*
out
)
->
objs
==
NULL
)
goto
err_with_distances
;
(
*
out
)
->
values
=
malloc
(
n
*
n
*
sizeof
(
*
((
*
out
)
->
values
)));
if
((
*
out
)
->
values
==
NULL
)
goto
err_with_objs
;
(
*
out
)
->
objs
=
AML_INNER_MALLOC_GET_ARRAY
(
*
out
,
hwloc_obj_t
,
struct
hwloc_distances_s
);
(
*
out
)
->
values
=
AML_INNER_MALLOC_GET_EXTRA
(
*
out
,
n
,
hwloc_obj_t
,
struct
hwloc_distances_s
);
(
*
out
)
->
nbobjs
=
n
;
for
(
unsigned
it0
=
0
;
it0
<
*
nt0
;
it0
++
)
...
...
@@ -385,12 +384,6 @@ static int aml_hwloc_distances_alloc(const hwloc_obj_type_t t0,
hwloc_get_obj_by_type
(
aml_topology
,
t1
,
it1
);
}
return
AML_SUCCESS
;
err_with_objs:
free
((
*
out
)
->
objs
);
err_with_distances:
free
(
*
out
);
return
-
AML_ENOMEM
;
}
#define OBJ_DIST(dist, i, j, row_stride, col_stride) \
...
...
@@ -399,13 +392,6 @@ err_with_distances:
#define IND_DIST(dist, i, j) (dist)->values[(i) * (dist)->nbobjs + (j)]
static
void
aml_hwloc_distances_free
(
struct
hwloc_distances_s
*
dist
)
{
free
(
dist
->
objs
);
free
(
dist
->
values
);
free
(
dist
);
}
/**
* Get distance matrix in hops between two types of objects.
* Distance matrix comes in the format used in <hwloc/distance.h>.
...
...
@@ -635,7 +621,7 @@ static int aml_hwloc_distances_reshape(struct hwloc_distances_s *dist,
return
AML_SUCCESS
;
err_with_out:
aml_hwloc_distances_
free
(
*
out
);
free
(
*
out
);
return
-
AML_FAILURE
;
}
...
...
@@ -651,8 +637,9 @@ int aml_hwloc_get_NUMA_distance(const hwloc_obj_type_t type,
enum
hwloc_distances_kind_e
kind
,
struct
hwloc_distances_s
**
out
)
{
int
err
=
AML_SUCCESS
;
// number of hwloc matrices to return in handle
unsigned
int
nr
=
32
;
unsigned
int
i
,
nr
=
32
;
// hwloc distance matrix
struct
hwloc_distances_s
*
handle
[
nr
],
*
dist
=
NULL
;
...
...
@@ -665,24 +652,27 @@ int aml_hwloc_get_NUMA_distance(const hwloc_obj_type_t type,
return
0
;
}
for
(
unsigned
i
=
0
;
i
<
nr
;
i
++
)
{
for
(
i
=
0
;
i
<
nr
;
i
++
)
{
// We pick any distance
if
(
dist
==
NULL
)
dist
=
handle
[
i
];
// If we found a matrix with same type as initiator type
// then we pick this one.
if
(
handle
[
i
]
->
objs
[
0
]
->
type
==
type
)
{
else
if
(
handle
[
i
]
->
objs
[
0
]
->
type
==
type
)
{
dist
=
handle
[
i
];
break
;
}
// We pick any distance
if
(
dist
==
NULL
)
dist
=
handle
[
i
];
// If we find one that is a NUMANODE distance, we chose this one
// over a default choice.
if
(
handle
[
i
]
->
objs
[
0
]
->
type
==
HWLOC_OBJ_NUMANODE
)
else
if
(
handle
[
i
]
->
objs
[
0
]
->
type
==
HWLOC_OBJ_NUMANODE
)
dist
=
handle
[
i
];
// If we find a distance that is finer grain than default,
// then we chose this one.
if
(
dist
->
objs
[
0
]
->
type
!=
HWLOC_OBJ_NUMANODE
&&
dist
->
objs
[
0
]
->
depth
<
handle
[
i
]
->
objs
[
0
]
->
depth
)
else
if
(
dist
->
objs
[
0
]
->
type
!=
HWLOC_OBJ_NUMANODE
&&
dist
->
objs
[
0
]
->
depth
<
handle
[
i
]
->
objs
[
0
]
->
depth
)
dist
=
handle
[
i
];
}
...
...
@@ -690,16 +680,20 @@ int aml_hwloc_get_NUMA_distance(const hwloc_obj_type_t type,
if
(
dist
==
NULL
)
{
if
(
aml_hwloc_distance_hop_matrix
(
type
,
HWLOC_OBJ_NUMANODE
,
out
)
!=
AML_SUCCESS
)
return
-
AML_ENOMEM
;
return
AML_SUCCESS
;
err
=
-
AML_ENOMEM
;
goto
out
;
}
// We reshape whatever matrix we got to be a distance to NUMANODEs
// matrix.
if
(
aml_hwloc_distances_reshape
(
dist
,
out
,
type
,
HWLOC_OBJ_NUMANODE
)
!=
AML_SUCCESS
)
return
-
AML_ENOMEM
;
return
AML_SUCCESS
;
err
=
-
AML_ENOMEM
;
out:
for
(
i
=
0
;
i
<
nr
;
i
++
)
hwloc_distances_release
(
aml_topology
,
handle
[
i
]);
return
err
;
}
int
aml_area_hwloc_preferred_create
(
struct
aml_area
**
area
,
...
...
@@ -770,8 +764,7 @@ int aml_area_hwloc_preferred_create(struct aml_area **area,
}
// Cleanup
aml_hwloc_distances_free
(
dist
);
free
(
dist
);
// Success !
*
area
=
ar
;
return
AML_SUCCESS
;
...
...
src/dma/cuda.c
View file @
0827bffb
...
...
@@ -152,6 +152,8 @@ int aml_dma_cuda_request_wait(struct aml_dma_data *data,
// the provided dma did not create the provided request.
if
(
dma_req
->
status
!=
AML_DMA_CUDA_REQUEST_STATUS_DONE
)
return
-
AML_EINVAL
;
aml_dma_cuda_request_destroy
(
data
,
req
);
return
AML_SUCCESS
;
}
...
...
tests/area/test_cuda.c
View file @
0827bffb
...
...
@@ -198,6 +198,8 @@ void test_unified_mmap(const int device)
assert
(
!
aml_area_munmap
(
area
,
unified_data
,
size
));
}
aml_area_cuda_destroy
(
&
area
);
free
(
host_copy
);
}
...
...
tests/area/test_hwloc.c
View file @
0827bffb
...
...
@@ -7,9 +7,11 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/
#include
"config.h"
#include
<assert.h>
#include
<hwloc.h>
#include
<stdlib.h>
#include
"aml.h"
...
...
@@ -171,6 +173,9 @@ void create_topology()
// Same values
assert
(
!
memcmp
(
hops
->
values
,
xml_hops
->
values
,
hops
->
nbobjs
*
sizeof
(
*
hops
->
values
)));
hwloc_distances_release
(
aml_topology
,
xml_hops
);
free
(
hops
);
}
void
test_preferred
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment