nperf / nblas Goto Github PK
View Code? Open in Web Editor NEWC++ bindings for CBLAS (Basic Linear Algebra Subprograms).
Home Page: http://nperf.github.io/nblas/
License: MIT License
C++ bindings for CBLAS (Basic Linear Algebra Subprograms).
Home Page: http://nperf.github.io/nblas/
License: MIT License
See my Complex16Array
example implementation in https://beta.observablehq.com/@mateogianolio/complex-numbers-in-javascript
Hi Mateo, thanks for sharing this library!
I looked into your rotmg.cc file and see the following:
void drotmg(const v8::FunctionCallbackInfo<v8::Value>& info) {
double *d1 = reinterpret_cast<double*>(GET_CONTENTS(info[0].As<v8::Float64Array>()));
double *d2 = reinterpret_cast<double*>(GET_CONTENTS(info[1].As<v8::Float64Array>()));
double *b1 = reinterpret_cast<double*>(GET_CONTENTS(info[2].As<v8::Float64Array>()));
const double b2 = info[3]->NumberValue();
double *param = reinterpret_cast<double*>(GET_CONTENTS(info[5].As<v8::Float64Array>()));
cblas_drotmg(d1, d2, b1, b2, param);
}
I'm not 100% sure, but it seems to me that info[5]
should be info[4]
.
When I try to install nblas from NPM I get the following error.
Does nblas really require xcode?
Exit code: 1
Command: node-gyp configure && node-gyp rebuild
Arguments:
Directory: /Users/samclearman/project/node_modules/nblas
Output:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
Traceback (most recent call last):
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py\", line 16, in <module>
sys.exit(gyp.script_main())
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py\", line 545, in script_main
return main(sys.argv[1:])
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py\", line 538, in main
return gyp_main(args)
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py\", line 523, in gyp_main
generator.GenerateOutput(flat_list, targets, data, params)
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py\", line 2170, in GenerateOutput
part_of_all=qualified_target in needed_targets)
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py\", line 795, in Write
self.Pchify))
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py\", line 1190, in WriteSources
cflags = self.xcode_settings.GetCflags(configname)
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py\", line 551, in GetCflags
archs = self.GetActiveArchs(self.configname)
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py\", line 420, in GetActiveArchs
xcode_archs_default = GetXcodeArchsDefault()
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py\", line 118, in GetXcodeArchsDefault
xcode_version, _ = XcodeVersion()
File \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py\", line 1265, in XcodeVersion
version = re.match(r'(\\d\\.\\d\\.?\\d*)', version).groups()[0]
AttributeError: 'NoneType' object has no attribute 'groups'
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command \"/Users/samclearman/.nvm/versions/node/v8.9.3/bin/node\" \"/Users/samclearman/.nvm/versions/node/v8.9.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"configure\"
gyp ERR! cwd /Users/samclearman/project/node_modules/nblas```
6.0.2
to 6.1.0
.This version is covered by your current version range and after updating it in your project the build failed.
mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
options
parameter (@plroebuck).jsonc
extension (@sstephant)These are soft-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
this.skip()
in "before each" hooks (@juergba)--allow-uncaught
for uncaught exceptions thrown inside hooks (@givanse)and some regressions:
Suite
cloning by copying root
property (@fatso83)The new version differs by 28 commits.
f4fc95a
Release v6.1.0
bd29dbd
update CHANGELOG for v6.1.0 [ci skip]
aaf2b72
Use cwd-relative pathname to load config file (#3829)
b079d24
upgrade deps as per npm audit fix; closes #3854
e87c689
Deprecate this.skip() for "after all" hooks (#3719)
81cfa90
Copy Suite property "root" when cloning; closes #3847 (#3848)
8aa2fc4
Fix issue 3714, hide pound icon showing on hover header on docs page (#3850)
586bf78
Update JS-YAML to address security issue (#3845)
d1024a3
Update doc examples "tests.html" (#3811)
1d570e0
Delete "/docs/example/chai.js"
ade8b90
runner.js: "self.test" undefined in Browser (#3835)
0098147
Replace findup-sync with find-up for faster startup (#3830)
d5ba121
Remove "package" flag from sample config file because it can only be passes as CLI arg (#3793)
a3089ad
update package-lock
75430ec
Upgrade yargs-parser dependency to avoid loading 2 copies of yargs
There are 28 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Hi developers,
After npm install nblas
and of course install libblas-dev in wsl2, an error raises:
ERROR in ../app/node_modules/nblas/dist/index.js 10:12-45
Module not found: Error: Can't resolve '../build/Release/nblas' in '/home/jicli594/molcrafts/projects/molvis/app/node_modules/nblas/dist'
ERROR in ../app/node_modules/nlapack/dist/index.js 9:14-49
Module not found: Error: Can't resolve '../build/Release/nlapack' in '/home/jicli594/molcrafts/projects/molvis/app/node_modules/nlapack/dist'
ERROR in ../app/node_modules/nblas/dist/index.js 13:12-30
Module not found: Error: Can't resolve './nblas' in '/home/jicli594/molcrafts/projects/molvis/app/node_modules/nblas/dist'
ERROR in ../app/node_modules/nlapack/dist/index.js 12:14-34
Module not found: Error: Can't resolve './nlapack' in '/home/jicli594/molcrafts/projects/molvis/app/node_modules/nlapack/dist'
I don't know how to fix it and here is my nblas dir:
I have no clue, could you please help me?
New to blass and am trying to modify routines to javascript.
I'm looking into updating some of my OpenCL node code, and seeing that I need to change it because of changes to nan. I have written all of my node c++ code using nan, but am now considering the alternative.
Did you find a performance increase by not using nan?
It appears that V8 has changed APIs for several of its types. You might want to look into NAN (probably the lowest effort) or N-API (only supports Node.js v10+)
A bug with Node.js is causing the offsets of subarrays to not be registered when using the following pattern Below code does not work with subarrays because the ArrayBuffer
offset is not taken into account:
v8::Local<v8::Float64Array> array = argument.As<v8::Float64Array>();
void *data = array->Buffer()->GetContents().Data();
double *x = static_cast<double*>(data);
This seems to be fixed by using the following hack:
v8::Local<v8::Float64Array> array = argument.As<v8::Float64Array>();
void *data = array->Buffer()->GetContents().Data();
size_t offset = array->ByteOffset();
size_t data_ptr = reinterpret_cast<size_t>(data);
data_ptr += offset;
double *x = reinterpret_cast<double*>(data_ptr);
However, it appears to be undefined behaviour in C++. Not sure if I should wait for Node.js to patch the bug or if I should incorporate above into the code.
Ping @metabench.
Here are the errors I've encountered:
npm ERR! In file included from ../routines/level1/dot.cc:2:
npm ERR! ../routines/level1/dot.cc: In function ‘void ddot(const v8::FunctionCallbackInfo<v8::Value>&)’:
npm ERR! ../lib/routines.h:7:46: error: ‘class v8::ArrayBuffer’ has no member named ‘GetContents’
npm ERR! 7 | (static_cast<unsigned char*>(view->Buffer()->GetContents().Data()) + view->ByteOffset())
npm ERR! | ^~~~~~~~~~~
npm ERR! ../routines/level1/dot.cc:6:53: note: in expansion of macro ‘GET_CONTENTS’
npm ERR! 6 | const double *x = reinterpret_cast<double*>(GET_CONTENTS(info[1].As<v8::Float64Array>()));
... and many more like that.
Also:
npm ERR! In file included from ../src/index.cc:1:
npm ERR! /home/larry/.cache/node-gyp/19.4.0/include/node/node.h:993:7: warning: cast between incompatible function types from ‘void (*)(v8::Local<v8::Object>)’ to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
npm ERR! 993 | (node::addon_register_func) (regfunc), \
npm ERR! | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/larry/.cache/node-gyp/19.4.0/include/node/node.h:1027:3: note: in expansion of macro ‘NODE_MODULE_X’
npm ERR! 1027 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
npm ERR! | ^~~~~~~~~~~~~
npm ERR! ../src/index.cc:121:1: note: in expansion of macro ‘NODE_MODULE’
npm ERR! 121 | NODE_MODULE(addon, Init)
npm ERR! | ^~~~~~~~~~~
Currently, the npm package refers to GetContents
, but my compiler is very eager to tell me ‘class v8::ArrayBuffer’ has no member named ‘GetContents’
. As mentioned in this SO post, this has been replaced with the GetBackingStore
function.
Additionally, it looks like node::addon_register_func
has had its function signature changed, and now requires two additional parameters.
Everything I know about bindings I learned in the last fifteen minutes trying to gather enough information for this issue to be intelligible.
Probably a low priority, but I ran into an issue when installing in conjunction with nvm
.
The install seems to be using the headers from my system node
([email protected]
) instead of my nvm
selected version ([email protected]
). The obvious workaround is just to upgrade the system level node
.
Just thought I'd go ahead and document this, since I ran into it.
waylonflinn@cecil:~/Development/js-vec-collection/vectorious$ npm install
-
> [email protected] install /home/waylonflinn/Development/js-vec-collection/vectorious/node_modules/nblas
> node-gyp configure && node-gyp rebuild
make: Entering directory `/home/waylonflinn/Development/js-vec-collection/vectorious/node_modules/nblas/build'
CXX(target) Release/obj.target/addon/addon.o
CXX(target) Release/obj.target/addon/functions/dot.o
../functions/dot.cc:3:11: error: ‘v8::Float64Array’ has not been declared
using v8::Float64Array;
^
../functions/dot.cc:4:11: error: ‘v8::Float32Array’ has not been declared
using v8::Float32Array;
^
In file included from /home/waylonflinn/.node-gyp/0.10.25/src/node_buffer.h:28:0,
from ../node_modules/nan/nan.h:46,
from ../functions/dot.h:4,
from ../functions/dot.cc:1:
../functions/dot.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE ddot(Nan::NAN_METHOD_ARGS_TYPE)’:
../functions/dot.cc:13:19: error: ‘class v8::Value’ has no member named ‘IsFloat64Array’
assert(info[1]->IsFloat64Array());
^
../functions/dot.cc:14:19: error: ‘class v8::Value’ has no member named ‘IsFloat64Array’
assert(info[3]->IsFloat64Array());
^
../functions/dot.cc:16:29: error: ‘Float64Array’ was not declared in this scope
void *x_data = info[1].As<Float64Array>()->Buffer()->GetContents().Data(),
^
../functions/dot.cc:16:43: error: no matching function for call to ‘v8::Local<v8::Value>::As()’
void *x_data = info[1].As<Float64Array>()->Buffer()->GetContents().Data(),
^
../functions/dot.cc:16:43: note: candidate is:
In file included from /home/waylonflinn/.node-gyp/0.10.25/src/node.h:62:0,
from ../node_modules/nan/nan.h:45,
from ../functions/dot.h:4,
from ../functions/dot.cc:1:
/home/waylonflinn/.node-gyp/0.10.25/deps/v8/include/v8.h:291:38: note: template<class S> v8::Local<S> v8::Local<T>::As() [with S = S; T = v8::Value]
template <class S> inline Local<S> As() {
^
/home/waylonflinn/.node-gyp/0.10.25/deps/v8/include/v8.h:291:38: note: template argument deduction/substitution failed:
../functions/dot.cc:16:43: error: template argument 1 is invalid
void *x_data = info[1].As<Float64Array>()->Buffer()->GetContents().Data(),
^
../functions/dot.cc:20:41: error: ‘y_data’ was not declared in this scope
*y = reinterpret_cast<double*>(y_data);
^
In file included from /home/waylonflinn/.node-gyp/0.10.25/src/node_buffer.h:28:0,
from ../node_modules/nan/nan.h:46,
from ../functions/dot.h:4,
from ../functions/dot.cc:1:
../functions/dot.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE sdot(Nan::NAN_METHOD_ARGS_TYPE)’:
../functions/dot.cc:32:19: error: ‘class v8::Value’ has no member named ‘IsFloat32Array’
assert(info[1]->IsFloat32Array());
^
../functions/dot.cc:33:19: error: ‘class v8::Value’ has no member named ‘IsFloat32Array’
assert(info[3]->IsFloat32Array());
^
../functions/dot.cc:35:29: error: ‘Float32Array’ was not declared in this scope
void *x_data = info[1].As<Float32Array>()->Buffer()->GetContents().Data(),
^
../functions/dot.cc:35:43: error: no matching function for call to ‘v8::Local<v8::Value>::As()’
void *x_data = info[1].As<Float32Array>()->Buffer()->GetContents().Data(),
^
../functions/dot.cc:35:43: note: candidate is:
In file included from /home/waylonflinn/.node-gyp/0.10.25/src/node.h:62:0,
from ../node_modules/nan/nan.h:45,
from ../functions/dot.h:4,
from ../functions/dot.cc:1:
/home/waylonflinn/.node-gyp/0.10.25/deps/v8/include/v8.h:291:38: note: template<class S> v8::Local<S> v8::Local<T>::As() [with S = S; T = v8::Value]
template <class S> inline Local<S> As() {
^
/home/waylonflinn/.node-gyp/0.10.25/deps/v8/include/v8.h:291:38: note: template argument deduction/substitution failed:
../functions/dot.cc:35:43: error: template argument 1 is invalid
void *x_data = info[1].As<Float32Array>()->Buffer()->GetContents().Data(),
^
../functions/dot.cc:39:39: error: ‘y_data’ was not declared in this scope
*y = reinterpret_cast<float*>(y_data);
^
make: *** [Release/obj.target/addon/functions/dot.o] Error 1
make: Leaving directory `/home/waylonflinn/Development/js-vec-collection/vectorious/node_modules/nblas/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-46-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/waylonflinn/Development/js-vec-collection/vectorious/node_modules/nblas
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok
npm ERR! Linux 3.13.0-46-generic
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.25
npm ERR! npm v2.7.4
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp configure && node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp configure && node-gyp rebuild'.
npm ERR! This is most likely a problem with the nblas package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp configure && node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls nblas
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/waylonflinn/Development/js-vec-collection/vectorious/npm-debug.log
E.g. how to omit m, n, k
from ?gemm
?
The current method looks best for when lblas is already installed.
Including the source code and building that with the addon would make it easier to install through npm.
Would it be worth referencing a version of lblas that gets compiled alongside the plugin when lbas is not already installed on the system?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.