Commit 41667393 authored by Swann Perarnau's avatar Swann Perarnau

Merge branch 'split-more-headers' into 'master'

Continue splitting headers.

See merge request !34
parents f257c6b8 c466f1da
Pipeline #6780 passed with stage
in 18 minutes and 42 seconds
......@@ -61,7 +61,6 @@ int main(int argc, char* argv[])
{
AML_ARENA_JEMALLOC_DECL(arns);
AML_ARENA_JEMALLOC_DECL(arnf);
AML_DMA_LINUX_SEQ_DECL(dma);
struct bitmask *slowb, *fastb;
aml_init(&argc, &argv);
assert(argc == 5);
......
......@@ -9,6 +9,8 @@
*******************************************************************************/
#include "aml.h"
#include "aml/dma/linux-seq.h"
#include "aml/scratch/par.h"
#include <assert.h>
#include <errno.h>
#include <mkl.h>
......
......@@ -9,6 +9,8 @@
*******************************************************************************/
#include "aml.h"
#include "aml/dma/linux-par.h"
#include "aml/scratch/seq.h"
#include <assert.h>
#include <errno.h>
#include <omp.h>
......
......@@ -9,6 +9,8 @@
*******************************************************************************/
#include "aml.h"
#include "aml/dma/linux-seq.h"
#include "aml/scratch/par.h"
#include <assert.h>
#include <errno.h>
#include <omp.h>
......
......@@ -15,6 +15,8 @@
#include <stdlib.h>
#include "aml.h"
#include "aml/dma/linux-seq.h"
#include "aml/scratch/par.h"
#include "utils.h"
#define ITER 10
......
include_HEADERS=aml.h
include_aml_dmadir=$(includedir)/aml/dma
include_aml_dma_HEADERS = \
aml/dma/linux-seq.h \
aml/dma/linux-par.h
include_aml_scratchdir=$(includedir)/aml/scratch
include_aml_scratch_HEADERS = \
aml/scratch/seq.h \
aml/scratch/par.h
include_amlutilsdir=$(includedir)/aml/utils
include_amlutils_HEADERS = \
aml/utils/vector.h \
......
This diff is collapsed.
/*******************************************************************************
* Copyright 2019 UChicago Argonne, LLC.
* (c.f. AUTHORS, LICENSE)
*
* This file is part of the AML project.
* For more info, see https://xgitlab.cels.anl.gov/argo/aml
*
* SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/
#ifndef AML_DMA_LINUX_PAR_H
#define AML_DMA_LINUX_PAR_H 1
/*******************************************************************************
* Linux Parallel DMA API:
* DMA logic implemented based on general linux API, with the caller thread
* used as the only execution thread.
******************************************************************************/
extern struct aml_dma_ops aml_dma_linux_par_ops;
struct aml_dma_linux_par_thread_data {
int tid;
pthread_t thread;
struct aml_dma_linux_par *dma;
struct aml_dma_request_linux_par *req;
};
struct aml_dma_request_linux_par {
int type;
void *dest;
void *src;
size_t size;
int count;
void **pages;
int *nodes;
struct aml_dma_linux_par_thread_data *thread_data;
};
struct aml_dma_linux_par_data {
size_t nbthreads;
struct aml_vector requests;
pthread_mutex_t lock;
};
struct aml_dma_linux_par_ops {
void *(*do_thread)(void *);
int (*do_copy)(struct aml_dma_linux_par_data *,
struct aml_dma_request_linux_par *, int tid);
int (*do_move)(struct aml_dma_linux_par_data *,
struct aml_dma_request_linux_par *, int tid);
};
struct aml_dma_linux_par {
struct aml_dma_linux_par_ops ops;
struct aml_dma_linux_par_data data;
};
#define AML_DMA_LINUX_PAR_DECL(name) \
struct aml_dma_linux_par __ ##name## _inner_data; \
struct aml_dma name = { \
&aml_dma_linux_par_ops, \
(struct aml_dma_data *)&__ ## name ## _inner_data, \
};
#define AML_DMA_LINUX_PAR_ALLOCSIZE \
(sizeof(struct aml_dma_linux_par) + \
sizeof(struct aml_dma))
/*
* Allocates and initializes a new parallel DMA.
* "dma": an address where the pointer to the newly allocated DMA structure
* will be stored.
* Variadic arguments:
* - "nbreqs": an argument of type size_t; the initial number of slots for
* asynchronous request that are in-flight (will be increased
* automatically if necessary).
* - "nbthreads": an argument of type size_t; the number of threads to launch
* for each request.
* Returns 0 if successful; an error code otherwise.
*/
int aml_dma_linux_par_create(struct aml_dma **, ...);
/*
* Initializes a new parallel DMA. This is a varargs-variant of the
* aml_dma_linux_par_vinit() routine.
* "dma": an allocated DMA structure.
* Variadic arguments: see aml_dma_linux_par_create().
* Returns 0 if successful; an error code otherwise.
*/
int aml_dma_linux_par_init(struct aml_dma *, ...);
/*
* Initializes a new parallel DMA.
* "dma": an allocated DMA structure.
* "args": see the variadic arguments of aml_dma_linux_par_create().
* Returns 0 if successful; an error code otherwise.
*/
int aml_dma_linux_par_vinit(struct aml_dma *, va_list);
/*
* Tears down an initialized parallel DMA.
* "dma": an initialized DMA structure.
* Returns 0 if successful; an error code otherwise.
*/
int aml_dma_linux_par_destroy(struct aml_dma *);
#endif // AML_LINUX_DMA_LINUX_PAR_H
/*******************************************************************************
* Copyright 2019 UChicago Argonne, LLC.
* (c.f. AUTHORS, LICENSE)
*
* This file is part of the AML project.
* For more info, see https://xgitlab.cels.anl.gov/argo/aml
*
* SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/
#ifndef AML_DMA_LINUX_SEQ_H
#define AML_DMA_LINUX_SEQ_H 1
/*******************************************************************************
* Linux Sequential DMA API:
* DMA logic implemented based on general linux API, with the caller thread
* used as the only execution thread.
******************************************************************************/
extern struct aml_dma_ops aml_dma_linux_seq_ops;
struct aml_dma_request_linux_seq {
int type;
void *dest;
void *src;
size_t size;
int count;
void **pages;
int *nodes;
};
struct aml_dma_linux_seq_data {
struct aml_vector requests;
pthread_mutex_t lock;
};
struct aml_dma_linux_seq_ops {
int (*do_copy)(struct aml_dma_linux_seq_data *dma,
struct aml_dma_request_linux_seq *req);
int (*do_move)(struct aml_dma_linux_seq_data *dma,
struct aml_dma_request_linux_seq *req);
};
struct aml_dma_linux_seq {
struct aml_dma_linux_seq_ops ops;
struct aml_dma_linux_seq_data data;
};
#define AML_DMA_LINUX_SEQ_DECL(name) \
struct aml_dma_linux_seq __ ##name## _inner_data; \
struct aml_dma name = { \
&aml_dma_linux_seq_ops, \
(struct aml_dma_data *)&__ ## name ## _inner_data, \
};
#define AML_DMA_LINUX_SEQ_ALLOCSIZE \
(sizeof(struct aml_dma_linux_seq) + \
sizeof(struct aml_dma))
/*
* Allocates and initializes a new sequential DMA.
* "dma": an address where the pointer to the newly allocated DMA structure
* will be stored.
* Variadic arguments:
* - "nbreqs": an argument of type size_t; the initial number of slots for
* asynchronous request that are in-flight (will be increased
* automatically if necessary).
* Returns 0 if successful; an error code otherwise.
*/
int aml_dma_linux_seq_create(struct aml_dma **dma, ...);
/*
* Initializes a new sequential DMA. This is a varargs-variant of the
* aml_dma_linux_seq_vinit() routine.
* "dma": an allocated DMA structure.
* Variadic arguments: see aml_dma_linux_seq_create().
* Returns 0 if successful; an error code otherwise.
*/
int aml_dma_linux_seq_init(struct aml_dma *dma, ...);
/*
* Initializes a new sequential DMA.
* "dma": an allocated DMA structure.
* "args": see the variadic arguments of aml_dma_linux_seq_create().
* Returns 0 if successful; an error code otherwise.
*/
int aml_dma_linux_seq_vinit(struct aml_dma *dma, va_list args);
/*
* Tears down an initialized sequential DMA.
* "dma": an initialized DMA structure.
* Returns 0 if successful; an error code otherwise.
*/
int aml_dma_linux_seq_destroy(struct aml_dma *dma);
/* Performs a copy request.
* "dma" the dma_linux_seq_data associated with a linux_seq dma.
* "req" a valid linux_seq request.
* Returns 0 if successful; an error code otherwise.
*/
int aml_dma_linux_seq_do_copy(struct aml_dma_linux_seq_data *dma,
struct aml_dma_request_linux_seq *req);
/* Performs a move request.
* "dma" the dma_linux_seq_data associated with a linux_seq dma.
* "req" a valid linux_seq request.
* Returns 0 if successful; an error code otherwise.
*/
int aml_dma_linux_seq_do_move(struct aml_dma_linux_seq_data *dma,
struct aml_dma_request_linux_seq *req);
#endif // AML_DMA_LINUX_SEQ_H
/*******************************************************************************
* Copyright 2019 UChicago Argonne, LLC.
* (c.f. AUTHORS, LICENSE)
*
* This file is part of the AML project.
* For more info, see https://xgitlab.cels.anl.gov/argo/aml
*
* SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/
#ifndef AML_SCRATCH_PAR_H
#define AML_SCRATCH_PAR_H 1
/*******************************************************************************
* Parallel scratchpad API:
* Scratchpad creates one thread to trigger synchronous dma movements.
******************************************************************************/
extern struct aml_scratch_ops aml_scratch_par_ops;
struct aml_scratch_request_par {
int type;
void *srcptr;
int srcid;
void *dstptr;
int dstid;
struct aml_scratch_par *scratch;
pthread_t thread;
};
struct aml_scratch_par_data {
struct aml_area *src_area, *sch_area;
struct aml_tiling *tiling;
struct aml_dma *dma;
void * sch_ptr;
struct aml_vector tilemap;
struct aml_vector requests;
pthread_mutex_t lock;
};
struct aml_scratch_par_ops {
void *(*do_thread)(void *);
};
struct aml_scratch_par {
struct aml_scratch_par_ops ops;
struct aml_scratch_par_data data;
};
#define AML_SCRATCH_PAR_DECL(name) \
struct aml_scratch_par __ ##name## _inner_data; \
struct aml_scratch name = { \
&aml_scratch_par_ops, \
(struct aml_scratch_data *)&__ ## name ## _inner_data, \
};
#define AML_SCRATCH_PAR_ALLOCSIZE \
(sizeof(struct aml_scratch_par) + \
sizeof(struct aml_scratch))
/*
* Allocates and initializes a new parallel scratchpad.
* "scratch": an address where the pointer to the newly allocated scratchpad
* structure will be stored.
* Variadic arguments:
* - "scratch_area": an argument of type struct aml_area*; the memory area
* where the scratchpad will be allocated from.
* - "source_area": an argument of type struct aml_area*; the memory area
* containing the user data structure.
* - "dma": an argument of type struct aml_dma*; the DMA that will be used for
* migrating data to and from the scratchpad.
* - "tiling": an argument of type struct aml_tiling*; the tiling to use on the
* user data structure and the scratchpad.
* - "nbtiles": an argument of type size_t; number of tiles to divide the
* scratchpad into.
* - "nbreqs": an argument of type size_t; the initial number of slots for
* asynchronous request that are in-flight (will be increased
* automatically if necessary).
* Returns 0 if successful; an error code otherwise.
*/
int aml_scratch_par_create(struct aml_scratch **scratch, ...);
/*
* Initializes a new parallel scratchpad. This is a varargs-variant of the
* aml_scratch_par_vinit() routine.
* "scratch": an allocated scratchpad structure.
* Variadic arguments: see aml_scratch_par_create().
* Returns 0 if successful; an error code otherwise.
*/
int aml_scratch_par_init(struct aml_scratch *scratch, ...);
/*
* Initializes a new parallel scratchpad.
* "scratch": an allocated scratchpad structure.
* "args": see the variadic arguments of see aml_scratch_par_create().
* Returns 0 if successful; an error code otherwise.
*/
int aml_scratch_par_vinit(struct aml_scratch *scratch, va_list args);
/*
* Tears down an initialized parallel scratchpad.
* "scratch": an initialized scratchpad structure.
* Returns 0 if successful; an error code otherwise.
*/
int aml_scratch_par_destroy(struct aml_scratch *scratch);
#endif // AML_SCRATCH_PAR_H
/*******************************************************************************
* Copyright 2019 UChicago Argonne, LLC.
* (c.f. AUTHORS, LICENSE)
*
* This file is part of the AML project.
* For more info, see https://xgitlab.cels.anl.gov/argo/aml
*
* SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/
#ifndef AML_SCRATCH_SEQ_H
#define AML_SCRATCH_SEQ_H 1
/*******************************************************************************
* Sequential scratchpad API:
* Scratchpad uses calling thread to trigger asynchronous dma movements.
******************************************************************************/
extern struct aml_scratch_ops aml_scratch_seq_ops;
struct aml_scratch_request_seq {
int type;
struct aml_tiling *tiling;
void *srcptr;
int srcid;
void *dstptr;
int dstid;
struct aml_dma_request *dma_req;
};
struct aml_scratch_seq_data {
struct aml_area *src_area, *sch_area;
struct aml_tiling *tiling;
struct aml_dma *dma;
void * sch_ptr;
struct aml_vector tilemap;
struct aml_vector requests;
pthread_mutex_t lock;
};
struct aml_scratch_seq_ops {
int (*doit)(struct aml_scratch_seq_data *scratch,
struct aml_scratch_request_seq *req);
};
struct aml_scratch_seq {
struct aml_scratch_seq_ops ops;
struct aml_scratch_seq_data data;
};
#define AML_SCRATCH_SEQ_DECL(name) \
struct aml_scratch_seq __ ##name## _inner_data; \
struct aml_scratch name = { \
&aml_scratch_seq_ops, \
(struct aml_scratch_data *)&__ ## name ## _inner_data, \
};
#define AML_SCRATCH_SEQ_ALLOCSIZE \
(sizeof(struct aml_scratch_seq) + \
sizeof(struct aml_scratch))
/*
* Allocates and initializes a new sequential scratchpad.
* "scratch": an address where the pointer to the newly allocated scratchpad
* structure will be stored.
* Variadic arguments:
* - "scratch_area": an argument of type struct aml_area*; the memory area
* where the scratchpad will be allocated from.
* - "source_area": an argument of type struct aml_area*; the memory area
* containing the user data structure.
* - "dma": an argument of type struct aml_dma*; the DMA that will be used for
* migrating data to and from the scratchpad.
* - "tiling": an argument of type struct aml_tiling*; the tiling to use on the
* user data structure and the scratchpad.
* - "nbtiles": an argument of type size_t; number of tiles to divide the
* scratchpad into.
* - "nbreqs": an argument of type size_t; the initial number of slots for
* asynchronous request that are in-flight (will be increased
* automatically if necessary).
* Returns 0 if successful; an error code otherwise.
*/
int aml_scratch_seq_create(struct aml_scratch **scratch, ...);
/*
* Initializes a new sequential scratchpad. This is a varargs-variant of the
* aml_scratch_seq_vinit() routine.
* "scratch": an allocated scratchpad structure.
* Variadic arguments: see aml_scratch_seq_create().
* Returns 0 if successful; an error code otherwise.
*/
int aml_scratch_seq_init(struct aml_scratch *scratch, ...);
/*
* Initializes a new sequential scratchpad.
* "scratch": an allocated scratchpad structure.
* "args": see the variadic arguments of see aml_scratch_seq_create().
* Returns 0 if successful; an error code otherwise.
*/
int aml_scratch_seq_vinit(struct aml_scratch *scratch, va_list args);
/*
* Tears down an initialized sequential scratchpad.
* "scratch": an initialized scratchpad structure.
* Returns 0 if successful; an error code otherwise.
*/
int aml_scratch_seq_destroy(struct aml_scratch *scratch);
#endif // AML_SCRATCH_SEQ_H
......@@ -9,6 +9,8 @@
*******************************************************************************/
#include "aml.h"
#include "aml/dma/linux-par.h"
#include <assert.h>
#include <errno.h>
#include <sys/mman.h>
......
......@@ -9,6 +9,8 @@
*******************************************************************************/
#include "aml.h"
#include "aml/dma/linux-seq.h"
#include <assert.h>
#include <errno.h>
#include <sys/mman.h>
......
......@@ -9,6 +9,7 @@
*******************************************************************************/
#include "aml.h"
#include "aml/scratch/par.h"
#include <assert.h>
/*******************************************************************************
......
......@@ -9,6 +9,7 @@
*******************************************************************************/
#include "aml.h"
#include "aml/scratch/seq.h"
#include <assert.h>
/*******************************************************************************
......
......@@ -9,6 +9,7 @@
*******************************************************************************/
#include "aml.h"
#include "aml/dma/linux-par.h"
#include <assert.h>
#define TILESIZE (2)
......
......@@ -9,6 +9,7 @@
*******************************************************************************/
#include "aml.h"
#include "aml/dma/linux-seq.h"
#include <assert.h>
#define TILESIZE (2)
......
......@@ -9,6 +9,8 @@
*******************************************************************************/
#include "aml.h"
#include "aml/dma/linux-seq.h"
#include "aml/scratch/par.h"
#include <assert.h>
#define TILESIZE (2)
......
......@@ -9,6 +9,8 @@
*******************************************************************************/
#include "aml.h"
#include "aml/dma/linux-par.h"
#include "aml/scratch/seq.h"
#include <assert.h>
#define TILESIZE (2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment