From e08d8d3d511f4f6d0d2e66a4d18933a31121cfae Mon Sep 17 00:00:00 2001 From: Pablo Oliveira Date: Thu, 15 Oct 2020 08:57:01 +0200 Subject: [PATCH 1/6] Remove trailing whitespace --- src/qmckl_context.org | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qmckl_context.org b/src/qmckl_context.org index 1aba050..2a4844b 100644 --- a/src/qmckl_context.org +++ b/src/qmckl_context.org @@ -1,6 +1,6 @@ # -*- mode: org -*- -#+TITLE: Context +#+TITLE: Context This file is written in C because it is more natural to express the context in C than in Fortran. @@ -17,7 +17,7 @@ C than in Fortran. is stored in the following data structure, which can't be seen outside of the library. - + #+BEGIN_SRC C :tangle qmckl_context.h #define QMCKL_DEFAULT_PRECISION 53 #define QMCKL_DEFAULT_RANGE 2 From 739d0dba3c72243eb84bcc4ce65fd388599d4b92 Mon Sep 17 00:00:00 2001 From: Pablo Oliveira Date: Thu, 15 Oct 2020 09:22:24 +0200 Subject: [PATCH 2/6] Add const qualifier since context is immutable --- src/qmckl_context.org | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/qmckl_context.org b/src/qmckl_context.org index 2a4844b..5d1f510 100644 --- a/src/qmckl_context.org +++ b/src/qmckl_context.org @@ -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; @@ -102,11 +102,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 +120,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 +141,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 +155,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; From a65d4b364839c3dd2a2f0daef80952518e15479c Mon Sep 17 00:00:00 2001 From: Pablo Oliveira Date: Thu, 15 Oct 2020 09:41:26 +0200 Subject: [PATCH 3/6] Fix Makefile --- src/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Makefile b/src/Makefile index cd61181..293255a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,17 +4,20 @@ CFLAGS= FC=gfortran FFLAGS= -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 "$^")' %.c %.h %_f.f90: %.org emacs --quick --no-init-file --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "$^")' -%.o: %.c +%.o: %.c $(CC) $(CFLAGS) -c $*.c -o $*.o %.o: %.f90 From 42637b4e18ac5f48fce1737149c55f6a931060a2 Mon Sep 17 00:00:00 2001 From: Pablo Oliveira Date: Thu, 15 Oct 2020 10:14:05 +0200 Subject: [PATCH 4/6] Add a github action to test build automatically --- .github/workflows/test-build.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/test-build.yml diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml new file mode 100644 index 0000000..f6baeb5 --- /dev/null +++ b/.github/workflows/test-build.yml @@ -0,0 +1,17 @@ +name: test-build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: make + run: make -C src/ From df8714f1db8b70e85784c9c2783a6c2a34e6b172 Mon Sep 17 00:00:00 2001 From: Pablo Oliveira Date: Thu, 15 Oct 2020 10:19:17 +0200 Subject: [PATCH 5/6] Add build success status badge to README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 7cafb1a..f0902ec 100644 --- a/README.md +++ b/README.md @@ -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. From 3be637dcc212ada38b6e68e21a37eca6ad27f364 Mon Sep 17 00:00:00 2001 From: Pablo de Oliveira Castro Date: Thu, 15 Oct 2020 12:17:20 +0200 Subject: [PATCH 6/6] Fix CI dependencies: must install emacs to untangle org files (#5) --- .github/workflows/test-build.yml | 2 ++ README.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index f6baeb5..7d22a09 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -13,5 +13,7 @@ jobs: steps: - uses: actions/checkout@v2 + - name: install dependencies + run: sudo apt-get install emacs - name: make run: make -C src/ diff --git a/README.md b/README.md index f0902ec..7d64383 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # qmckl -[![Build Status](https://github.com/TREX-CoE/qmckl/workflows/test-build/badge.svg?branch=main) +![Build Status](https://github.com/TREX-CoE/qmckl/workflows/test-build/badge.svg?branch=main) Quantum Monte Carlo Kernel Library.