Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
96c2eb4
move the CPU backend to a top level package
tafsiri Mar 30, 2020
5f82f28
add test runner to backend cpu
tafsiri Apr 1, 2020
ee82ec2
small refactor
tafsiri Apr 1, 2020
10e01b5
add backend cpu to cloudbuild
tafsiri Apr 1, 2020
549f151
fix file perms
tafsiri Apr 1, 2020
1423b74
fix test-snippets
tafsiri Apr 1, 2020
9616a99
add secrets
tafsiri Apr 1, 2020
94f068a
save
tafsiri Apr 1, 2020
cd1f2ce
save
tafsiri Apr 1, 2020
6cb5546
cleanup
tafsiri Apr 1, 2020
57cff9d
disable cpu testEnv in nightly of core.
tafsiri Apr 1, 2020
1c56c99
add cpu backend as dev dep of converter
tafsiri Apr 1, 2020
136be4a
save
tafsiri Apr 1, 2020
2f9cfe6
save
tafsiri Apr 1, 2020
5adc5c1
save
tafsiri Apr 1, 2020
18dc1ca
exclude web worker test from backend test suite
tafsiri Apr 2, 2020
8801964
converter cloudbuild, run yarn install
tafsiri Apr 2, 2020
e0d78c6
add backend-cpu as devDep in data and layers
tafsiri Apr 2, 2020
0a8f8a8
typo
tafsiri Apr 2, 2020
843acc6
typo
tafsiri Apr 2, 2020
d0864c6
fix
tafsiri Apr 2, 2020
4631eeb
fix build deps
tafsiri Apr 2, 2020
102ef4b
save
tafsiri Apr 2, 2020
50a1f59
save
tafsiri Apr 2, 2020
d70fd2e
typo
tafsiri Apr 2, 2020
77388f8
save
tafsiri Apr 2, 2020
7f541a9
save
tafsiri Apr 2, 2020
3bc1bc1
make sure cpu backend is built in ci
tafsiri Apr 2, 2020
a21d48f
restore engine test
tafsiri Apr 3, 2020
5c4224a
circumvent tsc circular import issue
tafsiri Apr 3, 2020
b96b1b9
make the kernel and gradient registries global
tafsiri Apr 3, 2020
c697c93
reorder build steps
tafsiri Apr 3, 2020
bcfbb83
skip test
tafsiri Apr 3, 2020
1fcca7a
add backend to test_snippets
tafsiri Apr 3, 2020
8c0d36d
make test_async_backends use backend from registry
tafsiri Apr 3, 2020
e47f0ce
add rollup config for cpu backend
tafsiri Apr 3, 2020
5f0e451
refactor global kernel/grad registries
tafsiri Apr 3, 2020
e19cb50
update rollup
tafsiri Apr 3, 2020
cf62008
remove unused packages and scripts
tafsiri Apr 3, 2020
ba1b18f
code review fixes
tafsiri Apr 7, 2020
7a81d4b
save
tafsiri Apr 7, 2020
d887b8d
save
tafsiri Apr 7, 2020
9ead647
Merge branch 'master' into move-cpu-backend
tafsiri Apr 7, 2020
31350ee
fix imports
tafsiri Apr 7, 2020
6e6834a
move pool utils
tafsiri Apr 7, 2020
a4b5e41
update scripts
tafsiri Apr 7, 2020
21b2c4f
Merge branch 'master' into move-cpu-backend
tafsiri Apr 8, 2020
0ad2ae2
kick build
tafsiri Apr 8, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cloudbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ steps:
waitFor: ['find-affected-packages']
env: ['NIGHTLY=$_NIGHTLY']

# CPU backend.
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
id: 'tfjs-backend-cpu'
args: ['./scripts/run-build.sh', 'tfjs-backend-cpu']
waitFor: ['find-affected-packages']
env: ['NIGHTLY=$_NIGHTLY']

# Converter.
- name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
Expand Down
3 changes: 2 additions & 1 deletion scripts/package_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"tfjs-converter": ["tfjs-core"],
"tfjs-layers": ["tfjs-core"],
"tfjs-data": ["tfjs-core", "tfjs-layers"],
"tfjs-backend-wasm": ["tfjs-core"]
"tfjs-backend-wasm": ["tfjs-core"],
"tfjs-backend-cpu": ["tfjs-core"]
}
27 changes: 27 additions & 0 deletions tfjs-backend-cpu/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.babelrc
.DS_Store
.idea/
.rpt2_cache
.travis.yml
.vscode
*.tgz
*.txt
**.yalc
**yalc.lock
cloudbuild.yml
coverage/
demo/
dist/**/*_test.d.ts
dist/**/*_test.js
karma.conf.js
node_modules/
npm-debug.log
package-lock.json
package/
rollup.config.js
scripts/
src/**/*_test.ts
tsconfig.json
tslint.json
yarn-error.log
yarn.lock
1 change: 1 addition & 0 deletions tfjs-backend-cpu/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
45 changes: 45 additions & 0 deletions tfjs-backend-cpu/cloudbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
steps:
# Install common dependencies.
- name: 'node:10'
id: 'yarn-common'
entrypoint: 'yarn'
args: ['install']

# Install webgpu dependencies.
- name: 'node:10'
dir: 'tfjs-backend-cpu'
id: 'yarn'
entrypoint: 'yarn'
args: ['install']
waitFor: ['yarn-common']

# Build core from master.
- name: 'node:10'
dir: 'tfjs-backend-cpu'
id: 'build-core'
entrypoint: 'yarn'
args: ['build-core-ci']
waitFor: ['yarn-common']

# Run tests.
- name: 'node:10'
dir: 'tfjs-backend-cpu'
entrypoint: 'yarn'
id: 'test-backend-cpu'
args: ['test-ci']
waitFor: ['build-core']
env: ['BROWSERSTACK_USERNAME=deeplearnjs1']
secretEnv: ['BROWSERSTACK_KEY']

# General configuration
secrets:
- kmsKeyName: projects/learnjs-174218/locations/global/keyRings/tfjs/cryptoKeys/enc
secretEnv:
BROWSERSTACK_KEY: CiQAkwyoIW0LcnxymzotLwaH4udVTQFBEN4AEA5CA+a3+yflL2ASPQAD8BdZnGARf78MhH5T9rQqyz9HNODwVjVIj64CTkFlUCGrP1B2HX9LXHWHLmtKutEGTeFFX9XhuBzNExA=
timeout: 1800s
logsBucket: 'gs://tfjs-build-logs'
substitutions:
_NIGHTLY: ''
options:
logStreamingOption: 'STREAM_ON'
substitution_option: 'ALLOW_LOOSE'
118 changes: 118 additions & 0 deletions tfjs-backend-cpu/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/**
* @license
* Copyright 2020 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/

const karmaTypescriptConfig = {
tsconfig: 'tsconfig.json',
// Disable coverage reports and instrumentation by default for tests
coverageOptions: {instrumentation: false},
reports: {},
bundlerOptions: {
sourceMap: true,
// Ignore the import of the `worker_threads` package used in a core test
// meant to run in node.
exclude: ['worker_threads'],
// worker_node_test in tfjs-core contains a conditional require statement
// that confuses the bundler of karma-typescript.
ignore: ['./worker_node_test']
}
};

module.exports = function(config) {
const args = [];
if (config.grep) {
args.push('--grep', config.grep);
}
if (config.flags) {
args.push('--flags', config.flags);
}
let exclude = [];
if (config.excludeTest != null) {
exclude.push(config.excludeTest);
}

config.set({
frameworks: ['jasmine', 'karma-typescript'],
files: [
'src/setup_test.ts',
{pattern: 'src/**/*.ts'},
],
preprocessors: {'**/*.ts': ['karma-typescript']},
karmaTypescriptConfig,
reporters: ['dots', 'karma-typescript'],
exclude,
colors: true,
autoWatch: false,
browsers: ['Chrome'],
singleRun: true,
client: {jasmine: {random: false}, args: args},
browserStack: {
username: process.env.BROWSERSTACK_USERNAME,
accessKey: process.env.BROWSERSTACK_KEY
},
captureTimeout: 120000,
reportSlowerThan: 500,
browserNoActivityTimeout: 240000,
customLaunchers: {
// For browserstack configs see:
// https://www.browserstack.com/automate/node
bs_chrome_mac: {
base: 'BrowserStack',
browser: 'chrome',
browser_version: 'latest',
os: 'OS X',
os_version: 'High Sierra'
},
bs_firefox_mac: {
base: 'BrowserStack',
browser: 'firefox',
browser_version: 'latest',
os: 'OS X',
os_version: 'High Sierra'
},
bs_safari_mac: {
base: 'BrowserStack',
browser: 'safari',
browser_version: 'latest',
os: 'OS X',
os_version: 'High Sierra'
},
bs_ios_11: {
base: 'BrowserStack',
device: 'iPhone X',
os: 'iOS',
os_version: '11.0',
real_mobile: true
},
bs_android_9: {
base: 'BrowserStack',
device: 'Google Pixel 3 XL',
os: 'android',
os_version: '9.0',
real_mobile: true
},
win_10_chrome: {
base: 'BrowserStack',
browser: 'chrome',
// Latest Chrome on Windows has WebGL problems:
// https://github.com/tensorflow/tfjs/issues/2272
browser_version: '77.0',
os: 'Windows',
os_version: '10'
},
},
})
}
70 changes: 70 additions & 0 deletions tfjs-backend-cpu/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"name": "@tensorflow/tfjs-backend-cpu",
"version": "0.0.0",
"description": "Vanilla JavaScript backend for TensorFlow.js",
"private": false,
"main": "dist/index.js",
"jsdelivr": "dist/tf-backend-cpu.min.js",
"unpkg": "dist/tf-backend-cpu.min.js",
"types": "dist/index.d.ts",
"jsnext:main": "dist/tf-backend-cpu.esm.js",
"module": "dist/tf-backend-cpu.esm.js",
"engines": {
"yarn": ">= 1.3.2"
},
"repository": {
"type": "git",
"url": "https://github.com/tensorflow/tfjs.git"
},
"license": "Apache-2.0",
"devDependencies": {
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@rollup/plugin-typescript": "^3.0.0",
"@tensorflow/tfjs-core": "link:../tfjs-core",
"@types/jasmine": "~3.0.0",
"clang-format": "~1.2.4",
"jasmine": "~3.1.0",
"jasmine-core": "~3.1.0",
"karma": "~4.4.1",
"karma-browserstack-launcher": "~1.4.0",
"karma-chrome-launcher": "~2.2.0",
"karma-jasmine": "~1.1.0",
"karma-typescript": "~4.1.1",
"npm-run-all": "~4.1.3",
"rimraf": "~2.6.2",
"rollup": "~2.3.2",
"rollup-plugin-terser": "~5.3.0",
"rollup-plugin-visualizer": "~3.3.2",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"tslint-no-circular-imports": "~0.5.0",
"typescript": "3.5.3",
"yalc": "~1.0.0-pre.21"
},
"scripts": {
"build-ci": "tsc",
"build": "tsc",
"build-core": "cd ../tfjs-core && yarn && yarn build",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also need build-core-ci, similar to this: https://github.com/tensorflow/tfjs/blob/master/tfjs-layers/package.json#L44
Because Core's build-ci is slightly different than build: https://github.com/tensorflow/tfjs/blob/master/tfjs-core/package.json#L55-L56

"build-core-ci": "cd ../tfjs-core && yarn && yarn build-ci",
"build-npm": "./scripts/build-npm.sh",
"link-local": "yalc link",
"publish-local": "rimraf dist/ && yarn build && rollup -c && yalc push",
"publish-npm": "npm publish",
"lint": "tslint -p . -t verbose",
"test": "yarn build-core && karma start",
"run-browserstack": "karma start --browserstack",
"test-ci": "./scripts/test-ci.sh"
},
"dependencies": {
"@types/seedrandom": "2.4.27",
"seedrandom": "2.4.3"
},
"peerDependencies": {
"@tensorflow/tfjs-core": "link:../tfjs-core"
},
"browser": {
"util": false,
"crypto": false
}
}
Loading