-
Notifications
You must be signed in to change notification settings - Fork 492
gradient compression support #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pleasantrabbit
merged 386 commits into
bytedance:master
from
jasperzhong:gradient_compression
Aug 13, 2020
Merged
Changes from all commits
Commits
Show all changes
386 commits
Select commit
Hold shift + click to select a range
7079d5e
compression: fix server bug
jasperzhong 6a5b6f2
compression: fix check
jasperzhong cc8a51a
compression: fix bug
jasperzhong ac86627
compression: fix a bug
jasperzhong 55f84b4
compression: rm check
jasperzhong 170b0fb
compression: fix bug
jasperzhong 247b3e3
compression: fix decompress
jasperzhong 1c4df37
compression: fix bug
jasperzhong 4eebf26
compression: fix fatal bug
jasperzhong 21fd9ef
compression: add log
jasperzhong ecfac06
compression: add log
jasperzhong af041b1
compression: fix fatal bug
jasperzhong 9b2b545
compression: test
jasperzhong 4c68f80
compression: rm logs
jasperzhong 47b7302
compression: rename
jasperzhong 303a0c8
compression: fix bug
jasperzhong 3df0ec3
compression: fix typo
jasperzhong 05eee8c
compression: refactor
jasperzhong 8a6c947
compression: refactor
jasperzhong 2df9a01
compression: fix typo
jasperzhong 0025204
compression: fix bug
jasperzhong 719915b
compression: fix bug
jasperzhong d24e035
compression: fix fatal bug
jasperzhong 67bb376
compression: fix typo
jasperzhong 3b9bf42
compression: fix test
jasperzhong 90fe93d
compression: test add shutdown
jasperzhong 4285ced
compression: add exit
jasperzhong df0abcf
compression: rm
jasperzhong 7c4f086
compression: finish ef
jasperzhong fc259c7
compression: fix error
jasperzhong 21ff784
compression: fix bug
jasperzhong c93bf95
compression: fix fatal bug
jasperzhong eca5893
compression: add args
jasperzhong d269496
compression: init zero
jasperzhong b9df722
compression: fix ef bug
jasperzhong f02d0a7
compression: use mean ef in server
jasperzhong 00d462d
compression: pack should inplace
jasperzhong 2b6c091
compression: add mean
jasperzhong 003f02a
compression: rm ops.cc mean when enable ef
jasperzhong 47aed64
compression: onebit add scale
jasperzhong 06971ed
compression: fix typo
jasperzhong d03834d
compression: fix typo
jasperzhong 08f6e26
compression: fix bug
jasperzhong 4cef1ee
compression: add ef to ns
jasperzhong 2a24707
compression: fix bug
jasperzhong a97fff0
compression: fix decompress with ef bug
jasperzhong 101a0a6
compression: make scaled onebit optional
jasperzhong c3a6d1a
compression: add scale in script
jasperzhong 7f0342a
compression: rm debuf
jasperzhong 5354b63
compression: rm debuf
jasperzhong 91eaf30
fix fatal bug
jasperzhong 88b6027
compression: add const
jasperzhong a7b38c1
compression: add const
jasperzhong d857211
compression: support partition for worker
jasperzhong 0a3c8d3
compression: add fp16 op support
jasperzhong 80a77aa
compression: support for fp16
jasperzhong 151a044
compression: fix missing
jasperzhong 1bb51ec
compression: fix fp16 avx
jasperzhong 23122e7
compression: fix typo
jasperzhong bc0c76f
compression: fix typo
jasperzhong 414716e
compression: fix typo
jasperzhong c8d219c
compression: fix typo
jasperzhong 0bbf3bc
compression: rm some warnings
jasperzhong 1563b29
compression: fix bug
jasperzhong 489662c
compression: rm a check
jasperzhong a028ad8
compression: fix align size bug
jasperzhong 5f61e9c
compression: test fp16 fp64
jasperzhong f54f7fb
compression: fix test bug
jasperzhong dd3dd07
compression: add mxnet fp16 compression support
jasperzhong 61bcb65
compression: add script fp args
jasperzhong 60b24a3
compression: rename
jasperzhong e92854a
compression: fix fp16 type bug
jasperzhong 9498d88
compression: fix intra-compression bug
jasperzhong 3d43588
compression: remove wait_to_read
jasperzhong d2b3976
compression: fix bug
jasperzhong fd291e7
compression: fix compressed released bug
jasperzhong f4ee9f4
compression: shallow copy to prevent gc
jasperzhong 608d609
compression: use shared_ptr
jasperzhong 1a235fe
compression: add copy
jasperzhong 16e4ed1
compression: fix bug
jasperzhong 848b556
compression: fix typo
jasperzhong 86da936
compression: fix bug
jasperzhong 28dec70
compression: add gluon-cv imagenet script
jasperzhong c74770e
compression: add momentum support
jasperzhong b12deca
compression: update script
jasperzhong 83fe21e
compression: disable server mom
jasperzhong 96a8133
compression: fix bug
jasperzhong c7f17ad
compression: fix typo
jasperzhong 8ef547d
compression: fix bug
jasperzhong d56c91d
compression: add mu
jasperzhong 76dff7b
compression: fix fatal impl missing
jasperzhong 22464c5
compression: update imagenet script
jasperzhong 882778f
compression: fix c++0x compile error
jasperzhong b255357
compression: fix typo
jasperzhong b778c29
compression: fix imagenet trianing script
jasperzhong 7147b58
compression: fix typo
jasperzhong 9be30ce
compression: advance registration for server
jasperzhong 3f5640e
compression: update register compressor
jasperzhong 9f42e3f
compression: fix bug
jasperzhong 1734e3b
compression: fix bug
jasperzhong 2f25d03
compression: add register sync
jasperzhong 594e580
compression: fix typo
jasperzhong 0472fe9
compression: fix bug
jasperzhong cb65d21
compression: fix typo
jasperzhong ceff0ab
compression: fix bug
jasperzhong 074c843
compression: add check
jasperzhong e9ee76c
compression: fix bug
jasperzhong efd2b74
compression: support async compression in server
jasperzhong f17bcdc
compression: fix bug
jasperzhong 30b2273
compression: rm useless comments
jasperzhong 613a06f
compression: disable small tensor
jasperzhong 270b0bb
compression: update openmp
jasperzhong 871503d
compression: fix compile bug
jasperzhong deda2f0
compression: fix bug
jasperzhong 5da1d3a
compression: fix bug
jasperzhong f275227
compression: fix typo
jasperzhong 8016349
compression: adjust omp thread num
jasperzhong 440c822
compression: make min compress bound mutable
jasperzhong af649c3
compression: use max threads
jasperzhong 8cffe9f
async: norm1 & rm scale
jasperzhong e5662c7
async: static_assert
jasperzhong 396e3c0
async: error-feedback
jasperzhong 5a66972
async: rm all async
jasperzhong 236f1c2
async: enable norm1
jasperzhong a80818a
async: set omp threads
jasperzhong f29ffd0
compression: update script
jasperzhong 2b0c8e2
async: compress in worker side
jasperzhong 8b01a30
async: mv log
jasperzhong db95e53
async: fix multi-gpus bugs
jasperzhong 0b7e136
async: fix typo
jasperzhong 6683233
async: add two loops
jasperzhong 5af389a
async: add func loops
jasperzhong 490be97
speedup: rm std::async
jasperzhong bb41159
speedup: set omp thread_num 1
jasperzhong 054d807
compression: update script
jasperzhong f31724d
compression: add thread_pool
jasperzhong 71c699d
compression: update script
jasperzhong 17da182
compression: set pool size = 8
jasperzhong cd6eb38
compression: fix typo
jasperzhong f14a605
compression: add cifar100 script
jasperzhong 75b60a9
compression: update script
jasperzhong 2fa725f
compression: update script
jasperzhong 6bad2db
compression: update script
jasperzhong 055dd35
compression: fix typo
jasperzhong 51ab4ad
script: update
jasperzhong c239431
compression: update 1bit
jasperzhong c6245a1
compression: rm final
jasperzhong 963a273
compression: fix typo
jasperzhong cb500cf
compression: fix typo
jasperzhong 1338d0d
compression: update script
jasperzhong 88fafaf
compression: update script
jasperzhong d0de4d6
compression: update script
jasperzhong 1ab6b12
compression: add time and fix typo
jasperzhong beead76
compression: use mmap
jasperzhong 90ab3b1
compression: update scripts
jasperzhong 6ec283d
compression: fix script typo
jasperzhong 688e36c
compression: fix mmap sigbus
jasperzhong e371b1f
comrpession: update header
jasperzhong 9e98e84
compression: add check and errno
jasperzhong 6d61bcd
compression: fix division zero
jasperzhong 0202364
compression: release resourses
jasperzhong 602e575
compression: use double lr
jasperzhong 8940668
compression: update script (default opt is nag)
jasperzhong a6155d8
register: refactor
jasperzhong 0a579e1
register: rm extra param
jasperzhong 356cbea
register: debug
jasperzhong 85edef9
register: fix typo
jasperzhong 3706abe
register: update argument parser
jasperzhong 776d5d7
compression: add weight decay momentum
jasperzhong 9fdec63
1bit-wd: fix static_method bug
jasperzhong 709e2cf
1bit-wd: fix typo
jasperzhong 81a412a
1bit-wd: fix typo
jasperzhong c2b17bb
1bit-wd: fix bug
jasperzhong 00b49e8
1bit-wd: init mom
jasperzhong 748ce02
1bit-wd: use cache
jasperzhong d16ac29
debug
jasperzhong d58cd1e
1bit-wd: fix
jasperzhong 110249f
1bit-wd: fix typo
jasperzhong 065f2ca
1bit-wd: add mnist test
jasperzhong b01e52c
1bit-wd: refactor interface
jasperzhong 239e8af
1bit-wd: update register
jasperzhong c84e722
1bit-wd: update script
jasperzhong 38ad4a0
1bit-wd: add log
jasperzhong 9ea0ba1
1bit-wd: fix fatal bug
jasperzhong 4a5ea5f
1bit-wd: rm logs
jasperzhong bcff3da
1bit-wd: fix typo
jasperzhong 258b476
1bit-wd: fix ref
jasperzhong 23fdcdd
1bit-wd: fix copy bug
jasperzhong 2fb7a80
1bit-wd: fix typo
jasperzhong 1de9174
1bit-wd: fix typo in script
jasperzhong b841f7b
1bit-wd: fix list out of range bug
jasperzhong 7a0bea6
compression: async wd momentum (#6)
jasperzhong b261e4b
hotfix: use default num_threads (#7)
jasperzhong f6fd608
hotfix: use concurrent.futures.Timeout (#8)
jasperzhong 1e40fd9
compression: speed up wd momentum with threading.Thread (#9)
jasperzhong 2379e17
compression: add topk compressor (#10)
jasperzhong 720d7e9
compression: add randomk compressor (#11)
jasperzhong d771932
numa: finetune support (#12)
jasperzhong afb96c8
rename: more readable (#13)
jasperzhong 3712c33
hotfix: update non-compression case register error (#14)
jasperzhong f881fb4
compression: allreduce results for training scripts (#16)
jasperzhong 3844228
hotfix: file mode use append (#17)
jasperzhong c17bfb6
compression: optimize implementation of compressors (#18)
jasperzhong 7f12e15
cifar: update (#19)
jasperzhong 6c45c79
hotfix: fix bugs (#20)
jasperzhong f7d9969
hotfix: fix fatal bug of new 1bit (#21)
jasperzhong ae30478
1bit: use double for scaling (#22)
jasperzhong c507e14
1bit: update wd mom (#23)
jasperzhong 2a98d12
refactor: format and rename (#24)
jasperzhong d063a38
test: add compressor test cases (#25)
jasperzhong 14a5bc0
misc: add comments (#26)
jasperzhong 3347570
1bit: update FastUpdateErrorImpl (#27)
jasperzhong e07d7ec
random: swtich to xorshift128p rng backend (#28)
jasperzhong bc2ab6d
misc: use macros (#29)
jasperzhong 6c44049
1bit: more parallelism (#31)
jasperzhong 3952f43
Dithering (#33)
jasperzhong 79f35b1
dithering: add ef support (#34)
jasperzhong 478c50b
update to lastest ps-lite
jasperzhong 90150a4
add docs (#35)
jasperzhong d08bdc6
Update byteps/common/core_loops.cc
jasperzhong 39391d2
Update byteps/common/core_loops.cc
jasperzhong 4522c52
dithering: optimize (#43)
jasperzhong a201d52
misc: fix typos
jasperzhong 7da0596
Update byteps/common/thread_pool.h
jasperzhong 1f190ed
misc: remove unused code & fix some warnings & keep non-alpha sum (#44)
jasperzhong ac1e9a3
dithering: add max normalization support (#45)
jasperzhong b4ecc6a
reduce: add num threads recommend (#46)
jasperzhong c132186
fp16: add fp16 support (#47)
jasperzhong cb221df
hotfix: fix register bugs of 1bit (#48)
jasperzhong 23e38eb
hotfix: fix server SIGSEGV when shutdown (#50)
jasperzhong c28f84c
topk: fix fatal bugs when k > 1 (#51)
jasperzhong 3068e31
dithering: fix natural dithering bug (#52)
jasperzhong 8b1218d
sparsification: support factor k (#55)
jasperzhong ced6f2b
hotfix: fix typo (#56)
jasperzhong fa7821b
hotfix: add log (#57)
jasperzhong 378cc2f
exp: update cifar100 (#58)
jasperzhong 7dc8d7f
misc: remove recommend omp threads (#59)
jasperzhong 6673b7d
1bit: not need to do wd mom for uncompressed gradients (#61)
jasperzhong a692fea
hotfix: fix distributed initialization #285
ZiyueHuang ba60a76
hotfix: merge two buffer (mentioned in #285)
jasperzhong c6464a9
Revert "hotfix: fix distributed initialization #285"
jasperzhong 40114f3
hotfix: remove unnecessary code
jasperzhong 7875987
test: full test coverage (#53)
jasperzhong 63bbb58
Merge branch 'master' into gradient_compression
jasperzhong e857315
misc: refactor wdmom
jasperzhong ec99e82
1bit: use wd_mult
jasperzhong dfcc670
1bit: update wd mom
jasperzhong 774f49c
mom: nag for uncompressed gradients (#62)
jasperzhong f894478
hotfix: fix wd mom issue (#63)
jasperzhong ef6f916
hotfix: update
jasperzhong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,3 +116,4 @@ venv.bak/ | |
|
||
# for development | ||
scripts/ | ||
exps/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// Copyright 2019 Amazon Inc. or its affiliates. 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. | ||
// ============================================================================= | ||
|
||
#ifndef BYTEPS_COMPRESSOR_COMMON_H | ||
#define BYTEPS_COMPRESSOR_COMMON_H | ||
|
||
#include <unordered_map> | ||
#if __F16C__ | ||
#include "../half.h" | ||
using half_t = mshadow::half::half_t; | ||
#endif | ||
|
||
namespace byteps { | ||
namespace common { | ||
namespace compressor { | ||
typedef char byte_t; | ||
/*! | ||
* \brief Tensor type | ||
*/ | ||
typedef struct BPSTensor { | ||
byte_t* data; | ||
size_t size; | ||
int dtype; | ||
|
||
BPSTensor() : data(nullptr), size(0), dtype(0) {} | ||
BPSTensor(void* data, size_t size = 0, int dtype = 0) | ||
: data(reinterpret_cast<byte_t*>(data)), size(size), dtype(dtype) {} | ||
} tensor_t; | ||
|
||
using kwargs_t = std::unordered_map<std::string, std::string>; | ||
|
||
#define COMPRESS_IMPL_SWITCH(dtype, func, dst, src, size) \ | ||
switch (dtype) { \ | ||
case BYTEPS_FLOAT16: \ | ||
return func(reinterpret_cast<uint16_t*>(dst), \ | ||
reinterpret_cast<const half_t*>(src), \ | ||
size / sizeof(half_t)); \ | ||
case BYTEPS_FLOAT32: \ | ||
return func(reinterpret_cast<uint32_t*>(dst), \ | ||
reinterpret_cast<const float*>(src), size / sizeof(float)); \ | ||
case BYTEPS_FLOAT64: \ | ||
return func(reinterpret_cast<uint64_t*>(dst), \ | ||
reinterpret_cast<const double*>(src), \ | ||
size / sizeof(double)); \ | ||
default: \ | ||
BPS_CHECK(0) << "Unsupported data type:" << dtype; \ | ||
} | ||
|
||
#define DECOMPRESS_IMPL_SWITCH(dtype, func, dst, src, compressed_size) \ | ||
switch (dtype) { \ | ||
case BYTEPS_FLOAT16: \ | ||
return func(reinterpret_cast<half_t*>(dst), \ | ||
reinterpret_cast<const uint16_t*>(src), compressed_size); \ | ||
case BYTEPS_FLOAT32: \ | ||
return func(reinterpret_cast<float*>(dst), \ | ||
reinterpret_cast<const uint32_t*>(src), compressed_size); \ | ||
case BYTEPS_FLOAT64: \ | ||
return func(reinterpret_cast<double*>(dst), \ | ||
reinterpret_cast<const uint64_t*>(src), compressed_size); \ | ||
default: \ | ||
BPS_CHECK(0) << "Unsupported data type:" << dtype; \ | ||
} | ||
|
||
#define FAST_UPDATE_ERROR_IMPL_SWITCH(dtype, func, dst, src1, src2, \ | ||
compressed_size) \ | ||
switch (dtype) { \ | ||
case BYTEPS_FLOAT16: \ | ||
return func(reinterpret_cast<half_t*>(dst), \ | ||
reinterpret_cast<half_t*>(src1), \ | ||
reinterpret_cast<const uint16_t*>(src2), compressed_size); \ | ||
case BYTEPS_FLOAT32: \ | ||
return func(reinterpret_cast<float*>(dst), \ | ||
reinterpret_cast<float*>(src1), \ | ||
reinterpret_cast<const uint32_t*>(src2), compressed_size); \ | ||
case BYTEPS_FLOAT64: \ | ||
return func(reinterpret_cast<double*>(dst), \ | ||
reinterpret_cast<double*>(src1), \ | ||
reinterpret_cast<const uint64_t*>(src2), compressed_size); \ | ||
default: \ | ||
BPS_CHECK(0) << "Unsupported data type:" << dtype; \ | ||
} | ||
|
||
} // namespace compressor | ||
} // namespace common | ||
} // namespace byteps | ||
|
||
#endif // BYTEPS_COMPRESSOR_COMMON_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
// Copyright 2019 Amazon Inc. or its affiliates. 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. | ||
// ============================================================================= | ||
|
||
#ifndef BYTEPS_COMPRESSOR_COMPRESSOR_H | ||
#define BYTEPS_COMPRESSOR_COMPRESSOR_H | ||
|
||
#include <memory> | ||
|
||
#include "../common.h" | ||
#include "../logging.h" | ||
#include "common.h" | ||
|
||
namespace byteps { | ||
namespace common { | ||
namespace compressor { | ||
/*! | ||
* \brief Compressor interface | ||
* Compressor defines two universal API - Compress & Decompress | ||
* | ||
* \par | ||
* The caller do not need to allocate additional memory to store compressed data | ||
* because there is an internal buffer to store the compressed data and the | ||
* pointer will be returned to the caller. Then the caller can send the returned | ||
* compressed data as normal. | ||
* | ||
* \par | ||
* There are two optional features of the compressor - error-feedback & | ||
* momentum. These two features can be added to any common compressors like 1bit | ||
* and topk. To be generic, these two features are also compressors, exposing | ||
* the same API as Compressor. More details can be found in their own files. | ||
* | ||
* \par | ||
* To add a new compressor, developers need to inherit this class in 'impl' | ||
* directory. If a new optional feature like error-feedback is needed, | ||
* developers need to use decorator pattern and add new files in the current | ||
* directory. The existing implementation can be used as a reference. | ||
* | ||
* | ||
* \sa ErrorFeedback, Momentum | ||
*/ | ||
class Compressor { | ||
public: | ||
Compressor(size_t size, DataType dtype) | ||
: _size(size), _dtype(dtype), _buf(new byte_t[size]){}; | ||
virtual ~Compressor() = default; | ||
|
||
/*! | ||
* \brief Compress function | ||
* | ||
* \note Except for error-feedback and momentum, the underlying data of input | ||
* should never be changed. this is because input is still used in error | ||
* feedback if enabled. | ||
* | ||
* \note Compressed data should be stored in the buffer of the compressor. So | ||
* it is not an inplace operation. | ||
* | ||
* \param grad gradient tensor, passed by value. | ||
* \return compressed tensor. it is the buffer of the compressor, | ||
* which contains the compressed data. the returned size is the size of | ||
* compressed data. | ||
*/ | ||
virtual tensor_t Compress(tensor_t grad) = 0; | ||
|
||
/*! | ||
* \brief Decompress function | ||
* | ||
* \note For servers, decompression is not an inplace operation. The | ||
* decompressed results locates in the buffer of the compressor. For workers, | ||
* it is an inplace operation. | ||
* | ||
* \param compressed compressed tensor. | ||
* \return decompressed tensor. For servers, it is the buffer of the | ||
* compressor, which contains the decompressed data. For workers, its pointer | ||
* is the same as the input's, while the size is decompressed size, which is | ||
* also the original size. | ||
*/ | ||
virtual tensor_t Decompress(tensor_t compressed) = 0; | ||
|
||
/*! | ||
* \brief faster version of `UpdateError` via operation fusion | ||
* | ||
* \par | ||
* This is a helper function implemented by each compressor. If defined, | ||
* `ErrorFeedback` will use this function instead of defualt `UpdateError` | ||
* function implemented in error_feedback.cc. If undefined, default | ||
* `UpdateError` will be used. | ||
* | ||
* \par | ||
* Typically `UpdateError` needs to decompress and do a substraction. But for | ||
* most compressors, the step of decompression can be avoided. For example, | ||
* for topk compressor, `UpdateError` can be simplied in this way: | ||
* 1. e <- p (e is the error and p is the corrected gradient) | ||
* 2. zero-fill e with selected k indices | ||
* | ||
* Actually it is a fusion of original decompression and substraction. It is | ||
* optional to override. | ||
* | ||
* \param corrected gradient corrected with error | ||
* \param error error | ||
* \param compressed compressed gradient | ||
*/ | ||
virtual void FastUpdateError(tensor_t error, tensor_t corrected, | ||
tensor_t compressed) { | ||
BPS_LOG(FATAL) << "FastUpdateError is not implemented"; | ||
}; | ||
|
||
protected: | ||
/*! \brief original size */ | ||
size_t _size; | ||
|
||
DataType _dtype; | ||
|
||
/*! \brief buffer to store compressed grad */ | ||
std::unique_ptr<byte_t[]> _buf; | ||
}; | ||
|
||
} // namespace compressor | ||
} // namespace common | ||
} // namespace byteps | ||
|
||
#endif // BYTEPS_COMPRESSOR_COMPRESSOR_H |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.