Skip to content

Commit

Permalink
MacOS CI - Not working yet but merging :/ (#170)
Browse files Browse the repository at this point in the history
* Updated CI

* Fix?

* Fix hehe

* FIx?

* Fix

* Fix

* Fix

* Fix

* Fix?

* Fix?

* Fix?

* Fix?

* Run

* Fix?

* Fix?

* Fix :c

* Fix?

* Fix

* Fix?

* ?

* Fix?

* Updated code
  • Loading branch information
ulises-jeremias authored Sep 4, 2023
1 parent a3930df commit ee4d964
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout VSL
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: vsl

Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/markdownlint.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: Markdown Lint

on:
workflow_call:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
markdownlint:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: Shellcheck

on:
workflow_call:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
shellcheck:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/todo.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Todo Checker

on:
workflow_call:
push:
branches:
- main

jobs:
todo:
Expand Down
78 changes: 59 additions & 19 deletions .github/workflows/ci.yml → .github/workflows/v-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

schedule:
- cron: "31 1,12 * * *"

push:
branches:
- main
Expand All @@ -20,24 +17,11 @@ on:
- main

jobs:
shellcheck:
name: Shellcheck
uses: ./.github/workflows/shellcheck.yml

markdownlint:
name: Markdown Lint
uses: ./.github/workflows/markdownlint.yml

todo:
if: github.event_name == 'push'
name: TODO
uses: ./.github/workflows/todo.yml

validate-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout VSL
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: vsl

Expand Down Expand Up @@ -79,7 +63,7 @@ jobs:

steps:
- name: Checkout VSL
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: vsl

Expand Down Expand Up @@ -133,7 +117,7 @@ jobs:

steps:
- name: Checkout VSL
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: vsl

Expand Down Expand Up @@ -178,3 +162,59 @@ jobs:
- name: Execute Tests using Pure V Backend with Pure C Blas and Garbage Collection enabled
run: ~/.vmodules/vsl/bin/test ${{ matrix.flags }} --use-cblas --use-gc boehm
if: ${{ matrix.os != 'ubuntu-18.04' }}

run-tests-on-macos:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- macos-latest
flags:
- ""
- "--prod"

steps:
- name: Checkout VSL
uses: actions/checkout@v3
with:
path: vsl

- name: Setup V
uses: vlang/[email protected]
with:
check-latest: true

- name: V doctor
run: v doctor

- name: Install dependencies
run: |
brew install coreutils
brew install gcc
brew install libomp
brew install hdf5
brew install open-mpi
brew install openblas
brew install lapack
- name: Move VSL source code to V Modules
run: mv ./vsl ~/.vmodules

- name: Execute Tests using Pure V Backend
# TODO: Remove continue-on-error when CI is fixed for macOS
continue-on-error: true
run: ~/.vmodules/vsl/bin/test

- name: Execute Tests using Pure V Backend with Pure C Blas
continue-on-error: true
run: ~/.vmodules/vsl/bin/test --use-cblas

- name: Execute Tests using Pure V Backend and Garbage Collection enabled
continue-on-error: true
run: ~/.vmodules/vsl/bin/test --use-gc boehm

- name: Execute Tests using Pure V Backend with Pure C Blas and Garbage Collection enabled
continue-on-error: true
run: ~/.vmodules/vsl/bin/test --use-cblas --use-gc boehm
94 changes: 47 additions & 47 deletions deriv/README.md
Original file line number Diff line number Diff line change
@@ -1,71 +1,71 @@
# Numerical Differentiation
# 🚀 Numerical Differentiation

This module provides functions for computing numerical derivatives of
functions.
This module provides functions for computing numerical derivatives of functions. 🧮

An adaptive algorithm is used to find the best
choice of finite difference and to estimate the error in the derivative.
An adaptive algorithm is used to find the best choice of finite difference and to
estimate the error in the derivative. 🎯

The development of this module is inspired by the same present in [GSL](https://github.com/ampl/gsl)
looking to adapt it completely to the practices and tools present in VSL.
The development of this module is inspired by the same present in
[GSL](https://github.com/ampl/gsl) 📚, looking to adapt it completely
to the practices and tools present in VSL. 🛠️

## Functions

### `central`

```v ignore
fn central (f func.Fn, x, h f64) (f64, f64)
```

This function computes the numerical derivative of the function `f`
at the point `x` using an adaptive central difference algorithm with
a step-size of `h`. The derivative is returned in `result` and an
estimate of its absolute error is returned in `abserr`.

The initial value of `h` is used to estimate an optimal step-size,
based on the scaling of the truncation error and round-off error in the
derivative calculation. The derivative is computed using a 5-point rule
for equally spaced abscissae at `x - h`, `x - h/2`, `x`,
`x + h/2`, `x+h`, with an error estimate taken from the difference
between the 5-point rule and the corresponding 3-point rule `x-h`,
`x`, `x+h`. Note that the value of the function at `x`
does not contribute to the derivative calculation, so only 4-points are
actually used.
This function computes the numerical derivative of the function `f` at the point `x`
using an adaptive central difference algorithm with a step-size of `h`. The derivative
is returned in `result` and an estimate of its absolute error is returned in `abserr`.

The initial value of `h` is used to estimate an optimal step-size, based on the scaling
of the truncation error and round-off error in the derivative calculation.
The derivative is computed using a 5-point rule for equally spaced abscissae
at `x - h`, `x - h/2`, `x`, `x + h/2`, `x+h`, with an error estimate taken
from the difference between the 5-point rule and the corresponding 3-point
rule `x-h`, `x`, `x+h`. Note that the value of the function at `x` does not
contribute to the derivative calculation, so only 4-points are actually used. 🧐

### `forward`

```v ignore
fn forward (f func.Fn, x, h f64) (f64, f64)
```

This function computes the numerical derivative of the function `f`
at the point `x` using an adaptive forward difference algorithm with
a step-size of `h`. The function is evaluated only at points greater
than `x`, and never at `x` itself. The derivative is returned in
`result` and an estimate of its absolute error is returned in
`abserr`. This function should be used if `f(x)` has a
discontinuity at `x`, or is undefined for values less than `x`.

The initial value of `h` is used to estimate an optimal step-size,
based on the scaling of the truncation error and round-off error in the
derivative calculation. The derivative at `x` is computed using an
"open" 4-point rule for equally spaced abscissae at `x+h/4`,
`x + h/2`, `x + 3h/4`, `x+h`, with an error estimate taken
from the difference between the 4-point rule and the corresponding
2-point rule `x+h/2`, `x+h`.
This function computes the numerical derivative of the function `f` at the point `x`
using an adaptive forward difference algorithm with a step-size of `h`. The function
is evaluated only at points greater than `x`, and never at `x` itself. The derivative
is returned in `result` and an estimate of its absolute error is returned in `abserr`.
This function should be used if `f(x)` has a discontinuity at `x`, or
is undefined for values less than `x`. 📈

The initial value of `h` is used to estimate an optimal step-size, based on the scaling
of the truncation error and round-off error in the derivative calculation. The derivative
at `x` is computed using an "open" 4-point rule for equally spaced abscissae at `x+h/4`,
`x + h/2`, `x + 3h/4`, `x+h`, with an error estimate taken from the difference between
the 4-point rule and the corresponding 2-point rule `x+h/2`, `x+h`. 🚀

### `backward`

```v ignore
fn backward (f func.Fn, x, h f64) (f64, f64)
```

This function computes the numerical derivative of the function `f`
at the point `x` using an adaptive backward difference algorithm
with a step-size of `h`. The function is evaluated only at points
less than `x`, and never at `x` itself. The derivative is
returned in `result` and an estimate of its absolute error is
returned in `abserr`. This function should be used if `f(x)`
has a discontinuity at `x`, or is undefined for values greater than
`x`.
This function computes the numerical derivative of the function `f` at the point `x`
using an adaptive backward difference algorithm with a step-size of `h`. The function
is evaluated only at points less than `x`, and never at `x` itself. The derivative is
returned in `result` and an estimate of its absolute error is returned in `abserr`.
This function should be used if `f(x)` has a discontinuity at `x`, or is undefined
for values greater than `x`. 📉

This function is equivalent to calling `deriv.forward` with a
negative step-size.
This function is equivalent to calling `deriv.forward` with a negative step-size.

## References and Further Reading

This work is a spiritual descendent of the Differentiation module in [GSL](https://github.com/ampl/gsl).
This work is a spiritual descendent of the Differentiation module in [GSL](https://github.com/ampl/gsl). 📖

Feel free to explore and utilize these numerical differentiation functions in
your projects! 🤖📊🔬
13 changes: 8 additions & 5 deletions diff/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Numerical Differentiation
# 🧮 Numerical Differentiation

This module provides functions for computing numerical derivatives of
functions.
This module equips you with powerful functions for calculating numerical
derivatives of functions. Dive into the world of numerical differentiation with ease! 🚀

An adaptive algorithm is used to find the best
choice of finite difference and to estimate the error in the derivative.
Utilizing an adaptive algorithm, we help you determine the optimal finite difference and
provide error estimates for your derivatives. Say goodbye to guesswork! 📊💡

Explore the possibilities and make your mathematical computations smoother with
Numerical Differentiation. 🌟
12 changes: 6 additions & 6 deletions mpi/_cflags.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module mpi

#flag linux -I/usr/lib/x86_64-linux-gnu/openmpi/include -I/usr/include/x86_64-linux-gnu/mpi -pthread
#flag linux -pthread -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi
#flag darwin -I/usr/local/Cellar/open-mpi/4.0.1_2/include -I/usr/local/include
#flag darwin -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/4.0.1_2/lib -L/usr/local/lib -lmpi
#flag freebsd -I/usr/local/Cellar/open-mpi/4.0.1_2/include -I/usr/local/include
#flag freebsd -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/4.0.1_2/lib -L/usr/local/lib -lmpi
#flag openbsd -I/usr/local/Cellar/open-mpi/4.0.1_2/include -I/usr/local/include
#flag openbsd -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/4.0.1_2/lib -L/usr/local/lib -lmpi
#flag darwin -I/usr/local/Cellar/open-mpi/4.1.5/include -I/usr/local/include
#flag darwin -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/4.1.5/lib -L/usr/local/lib -lmpi
#flag freebsd -I/usr/local/Cellar/open-mpi/4.1.5/include -I/usr/local/include
#flag freebsd -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/4.1.5/lib -L/usr/local/lib -lmpi
#flag openbsd -I/usr/local/Cellar/open-mpi/4.1.5/include -I/usr/local/include
#flag openbsd -L/usr/local/opt/libevent/lib -L/usr/local/Cellar/open-mpi/4.1.5/lib -L/usr/local/lib -lmpi
#flag -I@VMODROOT

#include <cmpi.h>
2 changes: 1 addition & 1 deletion vlas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ brew install openblas

## LAPACKE Backend

Use the flag `-d lapacke` to use the LAPACKE backend.
Use the flag `-d lapacke` to use the LAPACKE backend (enabled by default for now).

### Install dependencies

Expand Down
4 changes: 2 additions & 2 deletions vlas/cflags_d_cblas.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ module vlas
#flag linux -lopenblas -llapacke -L/usr/local/lib -L/usr/lib
#flag windows -O2
#flag windows -lopenblas -lgfortran
#flag darwin -I/usr/local/opt/openblas/include -I/usr/local/include
#flag darwin -lopenblas -L/usr/local/opt/openblas/lib -L/usr/local/lib
#flag darwin -I/usr/local/opt/openblas/include
#flag darwin -llapacke -lopenblas -L/usr/local/opt/openblas/lib
#flag -I@VMODROOT
4 changes: 2 additions & 2 deletions vlas/cflags_notd_cblas.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ module vlas
#flag linux -llapacke -L/usr/local/lib -L/usr/lib
#flag windows -O2
#flag windows -lopenblas -lgfortran
#flag darwin -I/usr/local/opt/openblas/include -I/usr/local/include
#flag darwin -lopenblas -L/usr/local/opt/openblas/lib -L/usr/local/lib
#flag darwin -I/usr/local/opt/openblas/include
#flag darwin -llapacke -lopenblas -L/usr/local/opt/openblas/lib
#flag -I@VMODROOT

0 comments on commit ee4d964

Please sign in to comment.