@digitaldefiance/node-accelerate 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +540 -0
- package/accelerate.cc +657 -0
- package/binding.gyp +24 -0
- package/index.d.ts +320 -0
- package/index.js +392 -0
- package/package.json +71 -0
- package/scripts/check-platform.js +102 -0
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@digitaldefiance/node-accelerate",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "High-performance Apple Accelerate framework bindings for Node.js - 283x faster matrix operations on Apple Silicon",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"preinstall": "node scripts/check-platform.js",
|
|
9
|
+
"install": "node-gyp rebuild",
|
|
10
|
+
"build": "node-gyp rebuild",
|
|
11
|
+
"test": "node test.js",
|
|
12
|
+
"benchmark": "node benchmark.js",
|
|
13
|
+
"compare": "node compare.js",
|
|
14
|
+
"prepublishOnly": "npm test",
|
|
15
|
+
"publish:public": "npm publish --access public"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"accelerate",
|
|
19
|
+
"apple",
|
|
20
|
+
"silicon",
|
|
21
|
+
"m1",
|
|
22
|
+
"m2",
|
|
23
|
+
"m3",
|
|
24
|
+
"m4",
|
|
25
|
+
"blas",
|
|
26
|
+
"vdsp",
|
|
27
|
+
"matrix",
|
|
28
|
+
"vector",
|
|
29
|
+
"fft",
|
|
30
|
+
"performance",
|
|
31
|
+
"native",
|
|
32
|
+
"addon",
|
|
33
|
+
"simd",
|
|
34
|
+
"amx"
|
|
35
|
+
],
|
|
36
|
+
"author": "Digital Defiance, Jessica Mulein <jessica@digitaldefiance.org>",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/Digital-Defiance/node-accelerate.git"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/Digital-Defiance/node-accelerate/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/Digital-Defiance/node-accelerate#readme",
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"node-addon-api": "^8.0.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"node-gyp": "^10.0.0"
|
|
51
|
+
},
|
|
52
|
+
"os": [
|
|
53
|
+
"darwin"
|
|
54
|
+
],
|
|
55
|
+
"cpu": [
|
|
56
|
+
"arm64",
|
|
57
|
+
"x64"
|
|
58
|
+
],
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=18.0.0"
|
|
61
|
+
},
|
|
62
|
+
"files": [
|
|
63
|
+
"accelerate.cc",
|
|
64
|
+
"binding.gyp",
|
|
65
|
+
"index.js",
|
|
66
|
+
"index.d.ts",
|
|
67
|
+
"README.md",
|
|
68
|
+
"LICENSE",
|
|
69
|
+
"scripts/"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Pre-install platform check
|
|
4
|
+
* Validates that the system can run node-accelerate
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const os = require('os');
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
|
|
10
|
+
const platform = process.platform;
|
|
11
|
+
const arch = process.arch;
|
|
12
|
+
|
|
13
|
+
console.log('Checking platform compatibility for node-accelerate...');
|
|
14
|
+
console.log(` Platform: ${platform}`);
|
|
15
|
+
console.log(` Architecture: ${arch}`);
|
|
16
|
+
console.log(` Node.js: ${process.version}`);
|
|
17
|
+
|
|
18
|
+
// Check platform
|
|
19
|
+
if (platform !== 'darwin') {
|
|
20
|
+
console.error('');
|
|
21
|
+
console.error('❌ ERROR: node-accelerate requires macOS');
|
|
22
|
+
console.error('');
|
|
23
|
+
|
|
24
|
+
if (platform === 'linux' && arch === 'arm64') {
|
|
25
|
+
console.error('Detected: Linux ARM64 (e.g., Raspberry Pi, AWS Graviton)');
|
|
26
|
+
console.error('');
|
|
27
|
+
console.error('This package uses Apple\'s Accelerate framework, which is only');
|
|
28
|
+
console.error('available on macOS. Linux ARM64 systems are not supported.');
|
|
29
|
+
console.error('');
|
|
30
|
+
console.error('For Linux ARM64, consider using:');
|
|
31
|
+
console.error(' • OpenBLAS: https://www.openblas.net/');
|
|
32
|
+
console.error(' • Eigen: https://eigen.tuxfamily.org/');
|
|
33
|
+
console.error(' • BLIS: https://github.com/flame/blis');
|
|
34
|
+
} else {
|
|
35
|
+
console.error('This package uses Apple\'s Accelerate framework, which is only');
|
|
36
|
+
console.error('available on macOS (darwin).');
|
|
37
|
+
console.error('');
|
|
38
|
+
console.error(`Your platform: ${platform}`);
|
|
39
|
+
console.error('Supported platforms: darwin (macOS only)');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.error('');
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Check architecture
|
|
47
|
+
if (arch !== 'arm64' && arch !== 'x64') {
|
|
48
|
+
console.error('');
|
|
49
|
+
console.error('❌ ERROR: Unsupported architecture');
|
|
50
|
+
console.error('');
|
|
51
|
+
console.error(`Your architecture: ${arch}`);
|
|
52
|
+
console.error('Supported architectures: arm64 (Apple Silicon), x64 (Intel)');
|
|
53
|
+
console.error('');
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Check for Accelerate framework
|
|
58
|
+
const acceleratePath = '/System/Library/Frameworks/Accelerate.framework';
|
|
59
|
+
if (!fs.existsSync(acceleratePath)) {
|
|
60
|
+
console.error('');
|
|
61
|
+
console.error('❌ ERROR: Apple Accelerate framework not found');
|
|
62
|
+
console.error('');
|
|
63
|
+
console.error(`Expected location: ${acceleratePath}`);
|
|
64
|
+
console.error('');
|
|
65
|
+
console.error('This is unusual for macOS. Please ensure you\'re running on a');
|
|
66
|
+
console.error('standard macOS system with system frameworks intact.');
|
|
67
|
+
console.error('');
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Check Node.js version
|
|
72
|
+
const nodeVersion = process.versions.node;
|
|
73
|
+
const [major] = nodeVersion.split('.').map(Number);
|
|
74
|
+
|
|
75
|
+
if (major < 18) {
|
|
76
|
+
console.error('');
|
|
77
|
+
console.error('❌ ERROR: Node.js version too old');
|
|
78
|
+
console.error('');
|
|
79
|
+
console.error(`Your version: ${nodeVersion}`);
|
|
80
|
+
console.error('Required: >= 18.0.0');
|
|
81
|
+
console.error('');
|
|
82
|
+
console.error('Please upgrade Node.js: https://nodejs.org/');
|
|
83
|
+
console.error('');
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Check for Xcode Command Line Tools
|
|
88
|
+
const xcodePath = '/Library/Developer/CommandLineTools';
|
|
89
|
+
if (!fs.existsSync(xcodePath)) {
|
|
90
|
+
console.warn('');
|
|
91
|
+
console.warn('⚠️ WARNING: Xcode Command Line Tools may not be installed');
|
|
92
|
+
console.warn('');
|
|
93
|
+
console.warn('node-accelerate requires Xcode Command Line Tools to build.');
|
|
94
|
+
console.warn('');
|
|
95
|
+
console.warn('If the build fails, install them with:');
|
|
96
|
+
console.warn(' xcode-select --install');
|
|
97
|
+
console.warn('');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
console.log('');
|
|
101
|
+
console.log('✓ Platform check passed!');
|
|
102
|
+
console.log('');
|