Skip to content

Commit

Permalink
fix memory size function
Browse files Browse the repository at this point in the history
  • Loading branch information
QinbinLi committed Oct 28, 2018
1 parent a524e6a commit 235979e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion include/thundersvm/model/svmmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ class SvmModel {
//return dec_values
const SyncArray<float_type> &get_dec_value() const;

//set max_memory_size during training and prediction
//set max_memory_size during training and prediction (input unit MB)
void set_max_memory_size(size_t size);

//set max_memory_size during training and prediction (input unit Byte)
void set_max_memory_size_Byte(size_t size);

//return n_binary_models
int get_n_binary_models() const;

Expand Down
5 changes: 5 additions & 0 deletions src/thundersvm/model/svmmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,10 @@ int SvmModel::get_working_set_size(int n_instances, int n_features) {

void SvmModel::set_max_memory_size(size_t size) {
if(size > 0)
this->param.max_mem_size = static_cast<size_t>(size) << 20;
}

void SvmModel::set_max_memory_size_Byte(size_t size) {
if(size > 0)
this->param.max_mem_size = static_cast<size_t>(size);
}
2 changes: 1 addition & 1 deletion src/thundersvm/thundersvm-predict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main(int argc, char **argv) {
CUDA_CHECK(cudaSetDevice(parser.gpu_id));
#endif

model->set_max_memory_size(parser.param_cmd.max_mem_size);
model->set_max_memory_size_Byte(parser.param_cmd.max_mem_size);
model->load_from_file(parser.svmpredict_model_file_name);
file.close();
file.open(parser.svmpredict_output_file, fstream::out);
Expand Down

0 comments on commit 235979e

Please sign in to comment.