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 dc62f61 commit 3185a5c
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/scopy/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/scopy.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 -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/scopy/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/scopy.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/scopy/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 @@ -48,6 +50,38 @@
]
},
{
"task": "benchmark",
"os": "linux",
"blas": "",
"wasm": false,
"src": [
"./src/scopy.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
},
{
"task": "examples",
"os": "linux",
"blas": "",
"wasm": false,
"src": [
"./src/scopy.c"
],
"include": [
"./include"
],
"libraries": [],
"libpath": [],
"dependencies": []
},

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

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

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

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

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

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

1 comment on commit 3185a5c

@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/scopy $\color{green}464/464$
$\color{green}+100.00\%$
$\color{green}43/43$
$\color{green}+100.00\%$
$\color{green}4/4$
$\color{green}+100.00\%$
$\color{green}464/464$
$\color{green}+100.00\%$

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

Please sign in to comment.