1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2025-01-03 10:06:09 +01:00

Merge pull request #1 from TREX-CoE/main

Merge with main of TREX-CoE
This commit is contained in:
vijay 2020-10-15 21:13:51 +02:00 committed by GitHub
commit 0c08855271
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 79 additions and 16 deletions

19
.github/workflows/test-build.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: test-build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: sudo apt-get install emacs
- name: make
run: make -C src/

View File

@ -1,4 +1,7 @@
# qmckl
![Build Status](https://github.com/TREX-CoE/qmckl/workflows/test-build/badge.svg?branch=main)
Quantum Monte Carlo Kernel Library.
See the [Wiki](https://github.com/TREX-CoE/qmckl/wiki) for more information.

12
TODO.org Normal file
View File

@ -0,0 +1,12 @@
* Set up CI on Travis
* Write tests
* malloc/free : Parameters for accelerators?
We should define qmckl_malloc and qmckl_free just to give the
possibility of the HPC implementations to define how they allocate the
memory (on CPU or GPU, using alternatives to malloc/free, etc).
A possibility could be to pass the id of a NUMA domain as a parameter of
qmckl_malloc, where the domain id is something obtained from the
context.

View File

@ -1,13 +1,17 @@
CC=gcc
CFLAGS=
CFLAGS=-fexceptions -Wall -Werror -Wpedantic -Wextra
FC=gfortran
FFLAGS=
FFLAGS=-fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising -Wintrinsics-std -Wno-tabs -Wintrinsic-shadow -Wline-truncation -Wreal-q-constant -Wuninitialized -fbacktrace -ffpe-trap=zero,overflow,underflow -finit-real=nan
SOURCE_FILES=$(wildcard *.org)
ORG_SOURCE_FILES=qmckl_context.org
OBJECT_FILES=$(patsubst %.org,%.o,$(ORG_SOURCE_FILES))
.PHONY: clean
all: $(OBJECT_FILES)
%.c %.h: %.org
emacs --quick --no-init-file --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "$^")'

View File

@ -66,11 +66,11 @@ qmckl_context qmckl_context_create() {
** =qmckl_context_copy=
#+BEGIN_SRC C :tangle qmckl_context.h
qmckl_context qmckl_context_copy(qmckl_context context);
qmckl_context qmckl_context_copy(const qmckl_context context);
#+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c
qmckl_context qmckl_context_copy(qmckl_context context) {
qmckl_context qmckl_context_copy(const qmckl_context context) {
qmckl_context_struct* old_context;
qmckl_context_struct* new_context;
@ -90,6 +90,31 @@ qmckl_context qmckl_context_copy(qmckl_context context) {
}
#+END_SRC
** =qmckl_context_destroy=
To delete a new context, use =qmckl_context_destroy()=. If the deletion
failed, the function returns =0=. On success, the function returns =1=
implying that the context has been freed.
#+BEGIN_SRC C :tangle qmckl_context.h
int qmckl_context_destroy(qmckl_context context);
#+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c
int qmckl_context_destroy(qmckl_context context) {
qmckl_context_struct* ctx;
ctx = (qmckl_context_struct*) context;
if (ctx == NULL) {
return 0;
}
free(ctx);
return 1;
}
#+END_SRC
* Precision
@ -102,11 +127,11 @@ qmckl_context qmckl_context_copy(qmckl_context context) {
** =qmckl_context_set_precision=
#+BEGIN_SRC C :tangle qmckl_context.h
qmckl_context qmckl_context_set_precision(qmckl_context context, int precision);
qmckl_context qmckl_context_set_precision(const qmckl_context context, int precision);
#+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c
qmckl_context qmckl_context_set_precision(qmckl_context context, int precision) {
qmckl_context qmckl_context_set_precision(const qmckl_context context, int precision) {
qmckl_context_struct* ctx;
if (precision < 2) return (qmckl_context) 0;
@ -120,11 +145,11 @@ qmckl_context qmckl_context_set_precision(qmckl_context context, int precision)
** =qmckl_context_set_range=
#+BEGIN_SRC C :tangle qmckl_context.h
qmckl_context qmckl_context_set_range(qmckl_context context, int range);
qmckl_context qmckl_context_set_range(const qmckl_context context, int range);
#+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c
qmckl_context qmckl_context_set_range(qmckl_context context, int range) {
qmckl_context qmckl_context_set_range(const qmckl_context context, int range) {
qmckl_context_struct* ctx;
if (range < 2) return (qmckl_context) 0;
@ -141,11 +166,11 @@ qmckl_context qmckl_context_set_range(qmckl_context context, int range) {
** =qmckl_context_get_precision=
#+BEGIN_SRC C :tangle qmckl_context.h
int qmckl_context_get_precision(qmckl_context context);
int qmckl_context_get_precision(const qmckl_context context);
#+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c
int qmckl_context_get_precision(qmckl_context context) {
int qmckl_context_get_precision(const qmckl_context context) {
qmckl_context_struct* ctx;
ctx = (qmckl_context_struct*) context;
return ctx->precision;
@ -155,11 +180,11 @@ int qmckl_context_get_precision(qmckl_context context) {
** =qmckl_context_get_range=
#+BEGIN_SRC C :tangle qmckl_context.h
int qmckl_context_get_range(qmckl_context context);
int qmckl_context_get_range(const qmckl_context context);
#+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c
int qmckl_context_get_range(qmckl_context context) {
int qmckl_context_get_range(const qmckl_context context) {
qmckl_context_struct* ctx;
ctx = (qmckl_context_struct*) context;
return ctx->range;