aml.h 19.6 KB
Newer Older
1 2 3
#ifndef AML_H
#define AML_H 1

4 5 6 7 8 9 10
#include <inttypes.h>
#include <numa.h>
#include <numaif.h>
#include <pthread.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
11
#include <stdlib.h>
12 13 14 15 16 17 18
#include <sys/mman.h>
#include <unistd.h>

#ifndef PAGE_SIZE
#define PAGE_SIZE 4096
#endif

19

20 21 22 23 24
/*******************************************************************************
 * Forward Declarations:
 ******************************************************************************/

struct aml_area;
25
struct aml_binding;
26 27 28

/*******************************************************************************
 * Arenas:
29 30
 * In-memory allocator implementation. Dispatches actual memory mappings back to
 * areas.
31 32
 ******************************************************************************/

33 34 35 36 37 38
#define AML_ARENA_FLAG_ZERO 1

/* opaque handle to configuration data */
struct aml_arena_data;

struct aml_arena_ops {
39 40 41 42 43 44 45
	int (*register_arena)(struct aml_arena_data *arena,
			      struct aml_area *area);
	int (*deregister_arena)(struct aml_arena_data *arena);
	void *(*mallocx)(struct aml_arena_data *arena, size_t size, int flags);
	void (*dallocx)(struct aml_arena_data *arena, void *ptr, int flags);
	void *(*reallocx)(struct aml_arena_data *arena, void *ptr, size_t size,
			  int flags);
46 47
};

48
struct aml_arena {
49 50
	struct aml_arena_ops *ops;
	struct aml_arena_data *data;
51 52
};

53 54 55 56 57 58
int aml_arena_register(struct aml_arena *arena, struct aml_area *area);
int aml_arena_deregister(struct aml_arena *arena);
void *aml_arena_mallocx(struct aml_arena *arena, size_t size, int flags);
void aml_arena_dallocx(struct aml_arena *arena, void *ptr, int flags);
void *aml_arena_reallocx(struct aml_arena *arena, void *ptr, size_t size,
			 int flags);
59 60 61 62 63 64 65 66 67 68

/*******************************************************************************
 * Jemalloc Arena:
 ******************************************************************************/
extern struct aml_arena_ops aml_arena_jemalloc_ops;

struct aml_arena_jemalloc_data {
	unsigned int uid;
	int flags;
};
69

70 71 72 73 74 75 76 77 78 79 80
#define AML_ARENA_JEMALLOC_DECL(name) \
	struct aml_arena_jemalloc_data __ ##name## _inner_data; \
	struct aml_arena name = { \
		&aml_arena_jemalloc_ops, \
		(struct aml_arena_data *)&__ ## name ## _inner_data, \
	};

#define AML_ARENA_JEMALLOC_ALLOCSIZE \
	(sizeof(struct aml_arena_jemalloc_data) + \
	 sizeof(struct aml_arena))

81 82 83 84 85

#define AML_ARENA_JEMALLOC_TYPE_REGULAR 0
#define AML_ARENA_JEMALLOC_TYPE_ALIGNED 1
#define AML_ARENA_JEMALLOC_TYPE_GENERIC 2

86 87 88 89
int aml_arena_jemalloc_create(struct aml_arena **arena, int type, ...);
int aml_arena_jemalloc_init(struct aml_arena *arena, int type, ...);
int aml_arena_jemalloc_vinit(struct aml_arena *arena, int type, va_list args);
int aml_arena_jemalloc_destroy(struct aml_arena *arena);
90

91 92 93 94 95
/*******************************************************************************
 * Areas:
 * embeds information about a byte-addressable physical memory location and well
 * as binding policies over it.
 ******************************************************************************/
96

97 98 99 100
/* opaque handle to configuration data */
struct aml_area_data;

struct aml_area_ops {
101 102 103 104 105 106 107 108 109 110
	void *(*malloc)(struct aml_area_data *area, size_t size);
	void (*free)(struct aml_area_data *area, void *ptr);
	void *(*calloc)(struct aml_area_data *area, size_t num, size_t size);
	void *(*realloc)(struct aml_area_data *area, void *ptr, size_t size);
	void *(*acquire)(struct aml_area_data *area, size_t size);
	void (*release)(struct aml_area_data *area, void *ptr);
	void *(*mmap)(struct aml_area_data *area, void *ptr, size_t size);
	int (*available)(struct aml_area_data *area);
	int (*binding)(struct aml_area_data *area,
		       struct aml_binding **binding);
111 112
};

113
struct aml_area {
114 115
	struct aml_area_ops *ops;
	struct aml_area_data *data;
116 117
};

118 119 120 121 122 123 124 125
/*******************************************************************************
 * POSIX Area:
 ******************************************************************************/

extern struct aml_area_ops aml_area_posix_ops;

struct aml_area_posix_data {
};
126

127 128 129 130 131 132 133 134 135 136 137
#define AML_AREA_POSIX_DECL(name) \
	struct aml_area_posix_data __ ##name## _inner_data; \
	struct aml_area name = { \
		&aml_area_posix_ops, \
		(struct aml_area_data *)&__ ## name ## _inner_data, \
	};

#define AML_AREA_POSIX_ALLOCSIZE \
	(sizeof(struct aml_area_posix_data) + \
	 sizeof(struct aml_area))

138 139 140 141
int aml_area_posix_create(struct aml_area **area);
int aml_area_posix_vinit(struct aml_area *area);
int aml_area_posix_init(struct aml_area *area);
int aml_area_posix_destroy(struct aml_area *area);
142 143

/*******************************************************************************
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
 * Linux Area:
 ******************************************************************************/

extern struct aml_area_ops aml_area_linux_ops;

struct aml_area_linux_manager_data {
	struct aml_arena *pool;
	size_t pool_size;
};

struct aml_area_linux_manager_ops {
	struct aml_arena *(*get_arena)(struct aml_area_linux_manager_data *data);
};

extern struct aml_area_linux_manager_ops aml_area_linux_manager_single_ops;

160 161 162
int aml_area_linux_manager_single_init(struct aml_area_linux_manager_data *data,
				       struct aml_arena *arena);
int aml_area_linux_manager_single_destroy(struct aml_area_linux_manager_data *data);
163 164 165 166 167

#define AML_MAX_NUMA_NODES 128
#define AML_NODEMASK_BYTES (AML_MAX_NUMA_NODES/8)
#define AML_NODEMASK_SZ (AML_NODEMASK_BYTES/sizeof(unsigned long))

168 169 170 171 172
#define AML_NODEMASK_NBITS (8*sizeof(unsigned long))
#define AML_NODEMASK_ELT(i) ((i) / AML_NODEMASK_NBITS)
#define AML_NODEMASK_BITMASK(i) ((unsigned long)1 << ((i) % AML_NODEMASK_NBITS))
#define AML_NODEMASK_ISSET(mask, i) \
	((mask[AML_NODEMASK_ELT(i)] & AML_NODEMASK_BITMASK(i)) != 0)
173 174 175 176 177 178
#define AML_NODEMASK_SET(mask, i) (mask[AML_NODEMASK_ELT(i)] |= AML_NODEMASK_BITMASK(i))
#define AML_NODEMASK_ZERO(mask) \
	do {								\
		for(unsigned int __i = 0; __i < AML_NODEMASK_SZ; __i++)	\
			mask[__i] = 0;					\
	} while(0)
179 180


181 182 183 184 185 186
struct aml_area_linux_mbind_data {
	unsigned long nodemask[AML_NODEMASK_SZ];
	int policy;
};

struct aml_area_linux_mbind_ops {
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
	int (*pre_bind)(struct aml_area_linux_mbind_data *data);
	int (*post_bind)(struct aml_area_linux_mbind_data *data, void *ptr,
			 size_t size);
	int (*binding)(struct aml_area_linux_mbind_data *data,
		       struct aml_binding **binding);
};

int aml_area_linux_mbind_setdata(struct aml_area_linux_mbind_data *data,
				 int policy, unsigned long *nodemask);
int aml_area_linux_mbind_generic_binding(struct aml_area_linux_mbind_data *data,
					 struct aml_binding **binding);
int aml_area_linux_mbind_regular_pre_bind(struct aml_area_linux_mbind_data *data);
int aml_area_linux_mbind_regular_post_bind(struct aml_area_linux_mbind_data *data,
					   void *ptr, size_t size);
int aml_area_linux_mbind_mempolicy_pre_bind(struct aml_area_linux_mbind_data *data);
int aml_area_linux_mbind_mempolicy_post_bind(struct aml_area_linux_mbind_data *data,
					   void *ptr, size_t size);
int aml_area_linux_mbind_init(struct aml_area_linux_mbind_data *data,
			      int policy, unsigned long *nodemask);
int aml_area_linux_mbind_destroy(struct aml_area_linux_mbind_data *data);
207 208 209 210 211 212 213 214 215 216 217 218

extern struct aml_area_linux_mbind_ops aml_area_linux_mbind_regular_ops;
extern struct aml_area_linux_mbind_ops aml_area_linux_mbind_mempolicy_ops;

struct aml_area_linux_mmap_data {
	int prot;
	int flags;
	int fildes;
	off_t off;
};

struct aml_area_linux_mmap_ops {
219 220
	void *(*mmap)(struct aml_area_linux_mmap_data *data, void *ptr,
		      size_t size);
221 222
};

223 224 225 226 227 228 229 230 231 232
void *aml_area_linux_mmap_generic(struct aml_area_linux_mmap_data *data,
				  void *ptr, size_t size);
int aml_area_linux_mmap_anonymous_init(struct aml_area_linux_mmap_data *data);
int aml_area_linux_mmap_fd_init(struct aml_area_linux_mmap_data *data, int fd,
				size_t max);
int aml_area_linux_mmap_tmpfile_init(struct aml_area_linux_mmap_data *data,
				     char *template, size_t max);
int aml_area_linux_mmap_anonymous_destroy(struct aml_area_linux_mmap_data *data);
int aml_area_linux_mmap_fd_destroy(struct aml_area_linux_mmap_data *data);
int aml_area_linux_mmap_tmpfile_destroy(struct aml_area_linux_mmap_data *data);
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252

extern struct aml_area_linux_mmap_ops aml_area_linux_mmap_generic_ops;

struct aml_area_linux_data {
	struct aml_area_linux_manager_data manager;
	struct aml_area_linux_mbind_data mbind;
	struct aml_area_linux_mmap_data mmap;
};

struct aml_area_linux_ops {
	struct aml_area_linux_manager_ops manager;
	struct aml_area_linux_mbind_ops mbind;
	struct aml_area_linux_mmap_ops mmap;
};

struct aml_area_linux {
	struct aml_area_linux_data data;
	struct aml_area_linux_ops ops;
};

253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
#define AML_AREA_LINUX_DECL(name) \
	struct aml_area_linux __ ##name## _inner_data; \
	struct aml_area name = { \
		&aml_area_linux_ops, \
		(struct aml_area_data *)&__ ## name ## _inner_data, \
	};

#define AML_AREA_LINUX_ALLOCSIZE \
	(sizeof(struct aml_area_linux) + \
	 sizeof(struct aml_area))

#define AML_AREA_LINUX_MANAGER_TYPE_SINGLE 0

#define AML_AREA_LINUX_MBIND_TYPE_REGULAR 0
#define AML_AREA_LINUX_MBIND_TYPE_MEMPOLICY 1

#define AML_AREA_LINUX_MMAP_TYPE_ANONYMOUS 0
#define AML_AREA_LINUX_MMAP_TYPE_FD 1
#define AML_AREA_LINUX_MMAP_TYPE_TMPFILE 2

273 274 275 276 277 278 279
int aml_area_linux_create(struct aml_area **area, int manager_type,
			  int mbind_type, int mmap_type, ...);
int aml_area_linux_init(struct aml_area *area, int manager_type, int mbind_type,
			int mmap_type, ...);
int aml_area_linux_vinit(struct aml_area *area, int manager_type,
			 int mbind_type, int mmap_type, va_list args);
int aml_area_linux_destroy(struct aml_area *area);
280 281 282 283 284

/*******************************************************************************
 * Generic Area API:
 * Low-level, direct access to area logic.
 * For memory allocation function, follows the POSIX spec.
285
 ******************************************************************************/
286

287 288 289 290 291 292 293 294 295
void *aml_area_malloc(struct aml_area *area, size_t size);
void aml_area_free(struct aml_area *area, void *ptr);
void *aml_area_calloc(struct aml_area *area, size_t num, size_t size);
void *aml_area_realloc(struct aml_area *area, void *ptr, size_t size);
void *aml_area_acquire(struct aml_area *area, size_t size);
void aml_area_release(struct aml_area *area, void *ptr);
void *aml_area_mmap(struct aml_area *area, void *ptr, size_t size);
int aml_area_available(struct aml_area *area);
int aml_area_binding(struct aml_area *area, struct aml_binding **binding);
296

297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
/*******************************************************************************
 * Tiling:
 * Representation of a data structure organization in memory.
 ******************************************************************************/

/* opaque handle to all tilings */
struct aml_tiling_data;
struct aml_tiling_iterator_data;

/*forward declarations */
struct aml_tiling_iterator_ops;
struct aml_tiling_iterator;


struct aml_tiling_ops {
312 313 314 315 316 317 318 319 320 321
	int (*create_iterator)(struct aml_tiling_data *tiling,
			       struct aml_tiling_iterator **iterator,
			       int flags);
	int (*init_iterator)(struct aml_tiling_data *tiling,
			     struct aml_tiling_iterator *iterator, int flags);
	int (*destroy_iterator)(struct aml_tiling_data *tiling,
				struct aml_tiling_iterator *iterator);
	size_t (*tilesize)(struct aml_tiling_data *tiling, int tileid);
	void* (*tilestart)(struct aml_tiling_data *tiling, void *ptr,
			   int tileid);
322 323 324 325 326 327 328
};

struct aml_tiling {
	struct aml_tiling_ops *ops;
	struct aml_tiling_data *data;
};

329 330
size_t aml_tiling_tilesize(struct aml_tiling *tiling, int tileid);
void* aml_tiling_tilestart(struct aml_tiling *tiling, void *ptr, int tileid);
331 332


333 334 335 336 337 338 339
int aml_tiling_create_iterator(struct aml_tiling *tiling,
			       struct aml_tiling_iterator **iterator,
			       int flags);
int aml_tiling_init_iterator(struct aml_tiling *tiling,
			     struct aml_tiling_iterator *iterator, int flags);
int aml_tiling_destroy_iterator(struct aml_tiling *tiling,
				struct aml_tiling_iterator *iterator);
340 341

struct aml_tiling_iterator_ops {
342 343 344 345
	int (*reset)(struct aml_tiling_iterator_data *iterator);
	int (*next)(struct aml_tiling_iterator_data *iterator);
	int (*end)(struct aml_tiling_iterator_data *iterator);
	int (*get)(struct aml_tiling_iterator_data *iterator, va_list args);
346 347 348 349 350 351 352
};

struct aml_tiling_iterator {
	struct aml_tiling_iterator_ops *ops;
	struct aml_tiling_iterator_data *data;
};

353 354 355 356
int aml_tiling_iterator_reset(struct aml_tiling_iterator *iterator);
int aml_tiling_iterator_next(struct aml_tiling_iterator *iterator);
int aml_tiling_iterator_end(struct aml_tiling_iterator *iterator);
int aml_tiling_iterator_get(struct aml_tiling_iterator *iterator, ...);
357 358 359

#define AML_TILING_TYPE_1D 0

360 361 362 363
int aml_tiling_create(struct aml_tiling **tiling, int type, ...);
int aml_tiling_init(struct aml_tiling *tiling, int type, ...);
int aml_tiling_vinit(struct aml_tiling *tiling, int type, va_list args);
int aml_tiling_destroy(struct aml_tiling *tiling, int type);
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411

/*******************************************************************************
 * Tiling 1D:
 ******************************************************************************/

extern struct aml_tiling_ops aml_tiling_1d_ops;
extern struct aml_tiling_iterator_ops aml_tiling_iterator_1d_ops;

struct aml_tiling_1d_data {
	size_t blocksize;
	size_t totalsize;
};

struct aml_tiling_iterator_1d_data {
	size_t i;
	struct aml_tiling_1d_data *tiling;
};

#define AML_TILING_1D_DECL(name) \
	struct aml_tiling_1d_data __ ##name## _inner_data; \
	struct aml_tiling name = { \
		&aml_tiling_1d_ops, \
		(struct aml_tiling_data *)&__ ## name ## _inner_data, \
	};

#define AML_TILING_ITERATOR_1D_DECL(name) \
	struct aml_tiling_iterator_1d_data __ ##name## _inner_data; \
	struct aml_tiling_iterator name = { \
		&aml_tiling_iterator_1d_ops, \
		(struct aml_tiling_iterator_data *)&__ ## name ## _inner_data, \
	};

#define AML_TILING_1D_ALLOCSIZE (sizeof(struct aml_tiling_1d_data) + \
				 sizeof(struct aml_tiling))

#define AML_TILING_ITERATOR_1D_ALLOCSIZE \
	(sizeof(struct aml_tiling_iterator_1d_data) + \
	 sizeof(struct aml_tiling_iterator))

/*******************************************************************************
 * Binding:
 * Representation of page bindings in an area
 ******************************************************************************/

/* opaque handle to all bindings */
struct aml_binding_data;

struct aml_binding_ops {
412 413 414 415 416 417
	int (*nbpages)(struct aml_binding_data *binding,
		       struct aml_tiling *tiling, void *ptr, int tileid);
	int (*pages)(struct aml_binding_data *binding, void **pages,
		     struct aml_tiling *tiling, void *ptr, int tileid);
	int (*nodes)(struct aml_binding_data *binding, int *nodes,
		     struct aml_tiling *tiling, void *ptr, int tileid);
418 419 420 421 422 423 424
};

struct aml_binding {
	struct aml_binding_ops *ops;
	struct aml_binding_data *data;
};

425 426 427 428 429 430
int aml_binding_nbpages(struct aml_binding *binding, struct aml_tiling *tiling,
			void *ptr, int tileid);
int aml_binding_pages(struct aml_binding *binding, void **pages,
		      struct aml_tiling *tiling, void *ptr, int tileid);
int aml_binding_nodes(struct aml_binding *binding, int *nodes,
		      struct aml_tiling *tiling, void *ptr, int tileid);
431 432 433 434

#define AML_BINDING_TYPE_SINGLE 0
#define AML_BINDING_TYPE_INTERLEAVE 1

435 436 437 438
int aml_binding_create(struct aml_binding **binding, int type, ...);
int aml_binding_init(struct aml_binding *binding, int type, ...);
int aml_binding_vinit(struct aml_binding *binding, int type, va_list args);
int aml_binding_destroy(struct aml_binding *binding, int type);
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483

/*******************************************************************************
 * Single Binding:
 * All pages on the same node
 ******************************************************************************/

extern struct aml_binding_ops aml_binding_single_ops;

struct aml_binding_single_data {
	int node;
};

#define AML_BINDING_SINGLE_DECL(name) \
	struct aml_binding_single_data __ ##name## _inner_data; \
	struct aml_binding name = { \
		&aml_binding_single_ops, \
		(struct aml_binding_data *)&__ ## name ## _inner_data, \
	};

#define AML_BINDING_SINGLE_ALLOCSIZE (sizeof(struct aml_binding_single_data) + \
				      sizeof(struct aml_binding))

/*******************************************************************************
 * Interleave Binding:
 * each page, of each tile, interleaved across nodes.
 ******************************************************************************/

extern struct aml_binding_ops aml_binding_interleave_ops;

struct aml_binding_interleave_data {
	int nodes[AML_MAX_NUMA_NODES];
	int count;
};

#define AML_BINDING_INTERLEAVE_DECL(name) \
	struct aml_binding_interleave_data __ ##name## _inner_data; \
	struct aml_binding name = { \
		&aml_binding_interleave_ops, \
		(struct aml_binding_data *)&__ ## name ## _inner_data, \
	};

#define AML_BINDING_INTERLEAVE_ALLOCSIZE \
	(sizeof(struct aml_binding_interleave_data) + \
	 sizeof(struct aml_binding))

484 485 486 487 488 489 490 491 492 493 494 495 496
/*******************************************************************************
 * DMA:
 * Management of low-level movement of memory.
 ******************************************************************************/

#define AML_DMA_REQUEST_TYPE_INVALID -1
#define AML_DMA_REQUEST_TYPE_COPY 0
#define AML_DMA_REQUEST_TYPE_MOVE 1

struct aml_dma_request_data;
struct aml_dma_data;

struct aml_dma_request_ops {
497 498
	int (*copy)(struct aml_dma_data *dma, struct aml_dma_request_data *req);
	int (*move)(struct aml_dma_data *dma, struct aml_dma_request_data *req);
499 500 501 502 503 504 505 506 507
};

struct aml_dma_request {
	struct aml_dma_request_ops *ops;
	struct aml_dma_request_data *data;
};


struct aml_dma_ops {
508 509 510 511 512 513 514
	int (*create_request)(struct aml_dma_data *dma,
			      struct aml_dma_request *req, int type,
			      va_list args);
	int (*destroy_request)(struct aml_dma_data *dma,
			       struct aml_dma_request *req);
	int (*wait_request)(struct aml_dma_data *dma,
			    struct aml_dma_request *req);
515 516 517 518 519 520 521
};

struct aml_dma {
	struct aml_dma_ops *ops;
	struct aml_dma_data *data;
};

522 523 524 525 526 527
int aml_dma_copy(struct aml_dma *dma, ...);
int aml_dma_async_copy(struct aml_dma *dma, struct aml_dma_request *req, ...);
int aml_dma_move(struct aml_dma *dma, ...);
int aml_dma_async_move(struct aml_dma *dma, struct aml_dma_request *req, ...);
int aml_dma_wait(struct aml_dma *dma, struct aml_dma_request *req);
int aml_dma_cancel(struct aml_dma *dma, struct aml_dma_request *req);
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552

/*******************************************************************************
 * Linux Sequential DMA API:
 * DMA logic implemented based on general linux API, with the caller thread
 * used as the only execution thread.
 ******************************************************************************/

struct aml_dma_request_linux_seq_data {
	int type;
	void *dest;
	void *src;
	size_t size;
	int count;
	void **pages;
	int *nodes;
};

extern struct aml_dma_ops aml_dma_linux_seq_ops;

struct aml_dma_linux_seq_data {
	size_t size;
	struct aml_dma_request_linux_seq_data *requests;
};

struct aml_dma_linux_seq_ops {
553 554 555 556
	int (*add_request)(struct aml_dma_linux_seq_data *dma,
			   struct aml_dma_request_linux_seq_data **req);
	int (*remove_request)(struct aml_dma_linux_seq_data *dma,
			      struct aml_dma_request_linux_seq_data **req);
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574
};

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))

575 576 577 578
int aml_dma_linux_seq_create(struct aml_dma **dma, ...);
int aml_dma_linux_seq_init(struct aml_dma *dma, ...);
int aml_dma_linux_seq_vinit(struct aml_dma *dma, va_list args);
int aml_dma_linux_seq_destroy(struct aml_dma *dma);
579

580 581 582 583
/*******************************************************************************
 * General functions:
 * Initialize internal structures, cleanup everything at the end.
 ******************************************************************************/
584

585 586
int aml_init(int *argc, char **argv[]);
int aml_finalize(void);
587

588
#endif