stdlib
stdlib copied to clipboard
feat: add C implementation for `blas/base/srotg`
Checklist
- [x] include.gypi
- [x] binding.gyp
- [x] include/stdlib/blas/base
- [x] src
- [x] manifest.json
- [ ] examples
- [ ] native
- [x] c
- [ ] benchmark
- [x] c
- [ ] fortran
- [ ] native
@kgryte
When I try to run c examples, it throws me the following log
$ make examples-c EXAMPLES_FILTER=.*/blas/base/srotg/.*
Running example: /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/examples/c/example.c
make[1]: Entering directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/examples/c'
make[1]: Leaving directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/examples/c'
Resolving package path...
Package path: /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg
Resolving package manifest...
Successfully resolved package manifest.
Resolving include directories...
Resolving source files...
Resolving libraries...
Resolving library paths...
Compiling example...
make[1]: Entering directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/examples/c'
../../src/srotg.c:20:10: fatal error: stdlib/math/base/special/absf.h: No such file or directory
20 | #include "stdlib/math/base/special/absf.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:107: example.out] Error 1
make[1]: Leaving directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/examples/c'
Error when attempting to compile example.
ERROR: An error was encountered during execution.
make: *** [/home/pranavchiku/stdlib/tools/make/lib/examples/c.mk:48: examples-c] Error 1
@Pranavchiku How are you running the example mentioned above? E.g., what is the command you are running?
Also, how have you tried debugging this already?
Feel free to push up the example code and associated Makefile. Without being able to see the files, hard to debug.
Can you also add an include entry to the package.json file?
How are you running the example mentioned above? E.g., what is the command you are running?
make examples-c EXAMPLES_FILTER=.*/blas/base/srotg/.*
Also, how have you tried debugging this already?
Everything else looks fine, I tried playing with package.json and manifest.json but was not able to resolve this.
Can you also add an include entry to the package.json file?
I am not sure. Do you mean "include": List of dependencies?
I mean in the "directories" field, along with src, benchmark, etc.
Am able to reproduce locally. Debugging now...
Okay. I know what the problem is. Working on a fix.
Should work now. In short, we need to update the build configurations to allow for using stdlib packages, which means supporting dependency resolution. Other BLAS packages, such as dcopy, etc, work with their current Makefiles as they don't depend at all on stdlib packages, such as absf, etc.
Okay, perfect! I will add rest of the files by today. Thank you for resolving this.
@kgryte I guess binding.gyp and include.gypi needs to be modified as well ( according to new manifest.json )
When I try to build node addons
make install-node-addons NODE_ADDONS_PATTERN=blas/base/srotg
It throws
$ make install-node-addons NODE_ADDONS_PATTERN=blas/base/srotg
Cleaning add-on: /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg
make[1]: Entering directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/src'
make[1]: Leaving directory '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/src'
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok
Building add-on: /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info find Python using Python version 3.9.12 found at "/home/pranavchiku/conda_root/bin/python3"
(node:38420) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info spawn /home/pranavchiku/conda_root/bin/python3
gyp info spawn args [
gyp info spawn args '/home/pranavchiku/stdlib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/pranavchiku/stdlib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/home/pranavchiku/.cache/node-gyp/16.19.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/home/pranavchiku/.cache/node-gyp/16.19.0',
gyp info spawn args '-Dnode_gyp_dir=/home/pranavchiku/stdlib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/home/pranavchiku/.cache/node-gyp/16.19.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
[eval]:1
var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }
^
TypeError: Cannot read properties of undefined (reading 'length')
at [eval]:1:173
at Script.runInThisContext (node:vm:129:12)
at Object.runInThisContext (node:vm:313:38)
at node:internal/process/execution:79:19
at [eval]-wrapper:6:22
at evalScript (node:internal/process/execution:78:60)
at node:internal/main/eval_string:27:3
gyp: Call to 'node -e "var arr = require('@stdlib/utils/library-manifest')('./manifest.json',{'os':'linux','blas':''},{'basedir':process.cwd(),'paths':'posix'}).include; for ( var i = 0; i < arr.length; i++ ) { console.log( arr[ i ] ); }"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/home/pranavchiku/stdlib/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Linux 5.19.0-38-generic
gyp ERR! command "/home/pranavchiku/.nvm/versions/node/v16.19.0/bin/node" "/home/pranavchiku/stdlib/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg
gyp ERR! node -v v16.19.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok
Error: failed to build add-on: /home/pranavchiku/stdlib/lib/node_modules/@stdlib/blas/base/srotg