Skip to content

Commit

Permalink
build: add separate configurations for benchmarks and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Apr 14, 2024
1 parent c021239 commit c8aa78f
Show file tree
Hide file tree
Showing 3 changed files with 259 additions and 15 deletions.
31 changes: 24 additions & 7 deletions lib/node_modules/@stdlib/blas/base/dscal/benchmark/c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,17 @@ else
fPIC ?= -fPIC
endif

# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
INCLUDE ?=

# List of source files:
c_src := ../../src/dscal.c
SOURCE_FILES ?=

# List of libraries (e.g., `-lopenblas -lpthread`):
LIBRARIES ?=

# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
LIBPATH ?=

# List of C targets:
c_targets := benchmark.length.out
Expand All @@ -79,11 +88,15 @@ c_targets := benchmark.length.out
# RULES #

#/
# Compiles C source files.
# Compiles source files.
#
# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
# @param {string} [CFLAGS] - C compiler options
# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`)
# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`)
# @param {string} [SOURCE_FILES] - list of source files
# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`)
#
# @example
# make
Expand All @@ -99,12 +112,16 @@ all: $(c_targets)
# Compiles C source files.
#
# @private
# @param {string} CC - C compiler
# @param {string} CFLAGS - C compiler flags
# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code
# @param {string} CC - C compiler (e.g., `gcc`)
# @param {string} CFLAGS - C compiler options
# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`)
# @param {string} SOURCE_FILES - list of source files
# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`)
# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`)
#/
$(c_targets): %.out: %.c
$(QUIET) $(CC) $(CFLAGS) $(fPIC) -I ../../include -I ../../../../../math/base/special/abs/include -o $@ $(c_src) $< -lm
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)

#/
# Runs compiled benchmarks.
Expand Down
33 changes: 25 additions & 8 deletions lib/node_modules/@stdlib/blas/base/dscal/examples/c/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,17 @@ else
fPIC ?= -fPIC
endif

# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
INCLUDE ?=

# List of source files:
c_src := ../../src/dscal.c
SOURCE_FILES ?=

# List of libraries (e.g., `-lopenblas -lpthread`):
LIBRARIES ?=

# List of library paths (e.g., `-L /foo/bar -L /beep/boop`):
LIBPATH ?=

# List of C targets:
c_targets := example.out
Expand All @@ -79,11 +88,15 @@ c_targets := example.out
# RULES #

#/
# Compiles C source files.
# Compiles source files.
#
# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`)
# @param {string} [CFLAGS] - C compiler options
# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code (e.g., `-fPIC`)
# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`)
# @param {string} [SOURCE_FILES] - list of source files
# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`)
# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`)
#
# @example
# make
Expand All @@ -99,15 +112,19 @@ all: $(c_targets)
# Compiles C source files.
#
# @private
# @param {string} CC - C compiler
# @param {string} CFLAGS - C compiler flags
# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code
# @param {string} CC - C compiler (e.g., `gcc`)
# @param {string} CFLAGS - C compiler options
# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`)
# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`)
# @param {string} SOURCE_FILES - list of source files
# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`)
# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`)
#/
$(c_targets): %.out: %.c
$(QUIET) $(CC) $(CFLAGS) $(fPIC) -I ../../include -o $@ $(c_src) $< -lm
$(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES)

#/
# Runs compiled benchmarks.
# Runs compiled examples.
#
# @example
# make run
Expand Down
210 changes: 210 additions & 0 deletions lib/node_modules/@stdlib/blas/base/dscal/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"options": {
"task": "build",
"os": "linux",
"blas": "",
"wasm": false
Expand Down Expand Up @@ -28,6 +29,7 @@
],
"confs": [
{
"task": "build",
"os": "linux",
"blas": "",
"wasm": false,
Expand All @@ -49,6 +51,38 @@
]
},
{
"task": "benchmark",
"os": "linux",
"blas": "",
"wasm": false,
"src": [
"./src/dscal.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
},
{
"task": "examples",
"os": "linux",
"blas": "",
"wasm": false,
"src": [
"./src/dscal.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
},

{
"task": "build",
"os": "linux",
"blas": "openblas",
"wasm": false,
Expand All @@ -72,6 +106,44 @@
]
},
{
"task": "benchmark",
"os": "linux",
"blas": "openblas",
"wasm": false,
"src": [
"./src/dscal_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lopenblas",
"-lpthread"
],
"libpath": [],
"dependencies": []
},
{
"task": "examples",
"os": "linux",
"blas": "openblas",
"wasm": false,
"src": [
"./src/dscal_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lopenblas",
"-lpthread"
],
"libpath": [],
"dependencies": []
},

{
"task": "build",
"os": "mac",
"blas": "",
"wasm": false,
Expand All @@ -93,6 +165,38 @@
]
},
{
"task": "benchmark",
"os": "mac",
"blas": "",
"wasm": false,
"src": [
"./src/dscal.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
},
{
"task": "examples",
"os": "mac",
"blas": "",
"wasm": false,
"src": [
"./src/dscal.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
},

{
"task": "build",
"os": "mac",
"blas": "apple_accelerate_framework",
"wasm": false,
Expand All @@ -115,6 +219,42 @@
]
},
{
"task": "benchmark",
"os": "mac",
"blas": "apple_accelerate_framework",
"wasm": false,
"src": [
"./src/dscal_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lblas"
],
"libpath": [],
"dependencies": []
},
{
"task": "examples",
"os": "mac",
"blas": "apple_accelerate_framework",
"wasm": false,
"src": [
"./src/dscal_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lblas"
],
"libpath": [],
"dependencies": []
},

{
"task": "build",
"os": "mac",
"blas": "openblas",
"wasm": false,
Expand All @@ -138,6 +278,44 @@
]
},
{
"task": "benchmark",
"os": "mac",
"blas": "openblas",
"wasm": false,
"src": [
"./src/dscal_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lopenblas",
"-lpthread"
],
"libpath": [],
"dependencies": []
},
{
"task": "examples",
"os": "mac",
"blas": "openblas",
"wasm": false,
"src": [
"./src/dscal_cblas.c"
],
"include": [
"./include"
],
"libraries": [
"-lopenblas",
"-lpthread"
],
"libpath": [],
"dependencies": []
},

{
"task": "build",
"os": "win",
"blas": "",
"wasm": false,
Expand All @@ -158,6 +336,38 @@
]
},
{
"task": "benchmark",
"os": "win",
"blas": "",
"wasm": false,
"src": [
"./src/dscal.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
},
{
"task": "examples",
"os": "win",
"blas": "",
"wasm": false,
"src": [
"./src/dscal.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
},

{
"task": "build",
"os": "",
"blas": "",
"wasm": true,
Expand Down

1 comment on commit c8aa78f

@stdlib-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage Report

Package Statements Branches Functions Lines
blas/base/dscal $\color{green}427/427$
$\color{green}+100.00\%$
$\color{green}41/41$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}427/427$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this push.

Please sign in to comment.