Skip to content

Instantly share code, notes, and snippets.

@dlovell
Last active December 31, 2015 04:09
Show Gist options
  • Save dlovell/7932850 to your computer and use it in GitHub Desktop.
Save dlovell/7932850 to your computer and use it in GitHub Desktop.
LocalEngine 'memory leak' @ 1360023db0e1f63936941cf6917f365e657ad8c9 With crosscat repo at /opt/crosscat and mem_usage.py, script.sh, test_local_engine.py all in the current working directory, run 'bash script.sh' to generate the out and err files.
creating local engine
done initialize
done analyze
done del; gc.collect()
creating local engine 0.00390625
done initialize 8.71875
done analyze 376.7734375
done del; gc.collect() 0.0
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
crosscat/cython_code/ContinuousComponentModel.cpp: In function ‘void __pyx_pf_8crosscat_11cython_code_24ContinuousComponentModel_26p_ContinuousComponentModel_2__dealloc__(__pyx_obj_8crosscat_11cython_code_24ContinuousComponentModel_p_ContinuousComponentModel*)’:
crosscat/cython_code/ContinuousComponentModel.cpp:881:31: warning: deleting object of polymorphic class type ‘ContinuousComponentModel’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
delete(__pyx_v_self->thisptr);
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cpp_code/src/utils.cpp: In function ‘std::vector<std::vector<int> > draw_crp_init(std::vector<int>, double, RandomNumberGenerator&, std::string)’:
cpp_code/src/utils.cpp:305:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<global_row_indices.size(); i++) {
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cpp_code/src/ContinuousComponentModel.cpp: In member function ‘virtual double ContinuousComponentModel::calc_element_predictive_logp_constrained(double, std::vector<double>) const’:
cpp_code/src/ContinuousComponentModel.cpp:90:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int constraint_idx=0; constraint_idx<constraints.size();
^
cpp_code/src/ContinuousComponentModel.cpp: In member function ‘double ContinuousComponentModel::get_draw_constrained(int, std::vector<double>) const’:
cpp_code/src/ContinuousComponentModel.cpp:212:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int constraint_idx=0; constraint_idx<constraints.size();
^
cpp_code/src/ContinuousComponentModel.cpp: In member function ‘double ContinuousComponentModel::get_predictive_cdf(double, std::vector<double>) const’:
cpp_code/src/ContinuousComponentModel.cpp:240:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int constraint_idx=0; constraint_idx<constraints.size();
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
crosscat/cython_code/MultinomialComponentModel.cpp: In function ‘void __pyx_pf_8crosscat_11cython_code_25MultinomialComponentModel_27p_MultinomialComponentModel_2__dealloc__(__pyx_obj_8crosscat_11cython_code_25MultinomialComponentModel_p_MultinomialComponentModel*)’:
crosscat/cython_code/MultinomialComponentModel.cpp:1018:31: warning: deleting object of polymorphic class type ‘MultinomialComponentModel’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
delete(__pyx_v_self->thisptr);
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cpp_code/src/utils.cpp: In function ‘std::vector<std::vector<int> > draw_crp_init(std::vector<int>, double, RandomNumberGenerator&, std::string)’:
cpp_code/src/utils.cpp:305:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<global_row_indices.size(); i++) {
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cpp_code/src/MultinomialComponentModel.cpp: In member function ‘virtual double MultinomialComponentModel::calc_element_predictive_logp_constrained(double, std::vector<double>) const’:
cpp_code/src/MultinomialComponentModel.cpp:77:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int constraint_idx=0; constraint_idx<constraints.size();
^
cpp_code/src/MultinomialComponentModel.cpp: In member function ‘virtual std::vector<double> MultinomialComponentModel::calc_hyper_conditionals(std::string, std::vector<double>) const’:
cpp_code/src/MultinomialComponentModel.cpp:98:10: warning: unused variable ‘dirichlet_alpha’ [-Wunused-variable]
double dirichlet_alpha = hyper_dirichlet_alpha;
^
cpp_code/src/MultinomialComponentModel.cpp: In member function ‘virtual void MultinomialComponentModel::init_suffstats()’:
cpp_code/src/MultinomialComponentModel.cpp:151:10: warning: unused variable ‘dirichlet_alpha’ [-Wunused-variable]
double dirichlet_alpha = hyper_dirichlet_alpha;
^
cpp_code/src/MultinomialComponentModel.cpp: In member function ‘void MultinomialComponentModel::get_keys_counts_for_draw(std::vector<std::basic_string<char> >&, std::vector<double>&, std::map<std::basic_string<char>, double>) const’:
cpp_code/src/MultinomialComponentModel.cpp:161:7: warning: unused variable ‘K’ [-Wunused-variable]
int K = hyper_K;
^
cpp_code/src/MultinomialComponentModel.cpp: In member function ‘double MultinomialComponentModel::get_draw_constrained(int, std::vector<double>) const’:
cpp_code/src/MultinomialComponentModel.cpp:209:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int constraint_idx=0; constraint_idx<constraints.size(); constraint_idx++) {
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
crosscat/cython_code/State.cpp: In function ‘PyObject* __pyx_pw_8crosscat_11cython_code_5State_7p_State_37transition(PyObject*, PyObject*, PyObject*)’:
crosscat/cython_code/State.cpp:5434:56: warning: ‘__pyx_v_seed’ may be used uninitialized in this function [-Wmaybe-uninitialized]
__pyx_t_4 = PyInt_FromLong(__pyx_v_seed); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L8_error;}
^
crosscat/cython_code/State.cpp:4986:7: note: ‘__pyx_v_seed’ was declared here
int __pyx_v_seed;
^
In file included from /usr/include/python2.7/numpy/ndarrayobject.h:26:0,
from /usr/include/python2.7/numpy/arrayobject.h:14,
from crosscat/cython_code/State.cpp:262:
/usr/include/python2.7/numpy/__multiarray_api.h: At global scope:
/usr/include/python2.7/numpy/__multiarray_api.h:1532:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
_import_array(void)
^
In file included from /usr/include/python2.7/numpy/ufuncobject.h:152:0,
from crosscat/cython_code/State.cpp:263:
/usr/include/python2.7/numpy/__ufunc_api.h:226:1: warning: ‘int _import_umath()’ defined but not used [-Wunused-function]
_import_umath(void)
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cpp_code/src/utils.cpp: In function ‘std::vector<std::vector<int> > draw_crp_init(std::vector<int>, double, RandomNumberGenerator&, std::string)’:
cpp_code/src/utils.cpp:305:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<global_row_indices.size(); i++) {
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cpp_code/src/View.cpp: In member function ‘void View::assert_state_consistency()’:
cpp_code/src/View.cpp:688:10: warning: unused variable ‘tolerance’ [-Wunused-variable]
double tolerance = 1E-10;
^
cpp_code/src/View.cpp:690:7: warning: unused variable ‘sum_via_cluster_counts’ [-Wunused-variable]
int sum_via_cluster_counts = std::accumulate(cluster_counts.begin(),
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cpp_code/src/Cluster.cpp: In member function ‘void Cluster::delete_component_models(bool)’:
cpp_code/src/Cluster.cpp:40:12: warning: deleting object of polymorphic class type ‘ComponentModel’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
delete p_cm;
^
cpp_code/src/Cluster.cpp: In member function ‘double Cluster::calc_column_predictive_logp(std::vector<double>, std::string, std::vector<int>, CM_Hypers)’:
cpp_code/src/Cluster.cpp:131:10: warning: deleting object of polymorphic class type ‘ComponentModel’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
delete p_cm;
^
cpp_code/src/Cluster.cpp: In member function ‘double Cluster::insert_row(std::vector<double>, int)’:
cpp_code/src/Cluster.cpp:138:34: warning: variable ‘set_pair’ set but not used [-Wunused-but-set-variable]
pair<set<int>::iterator, bool> set_pair = \
^
cpp_code/src/Cluster.cpp: In member function ‘double Cluster::remove_row(std::vector<double>, int)’:
cpp_code/src/Cluster.cpp:152:16: warning: unused variable ‘num_removed’ [-Wunused-variable]
unsigned int num_removed = row_indices.erase(row_idx);
^
cpp_code/src/Cluster.cpp: In member function ‘double Cluster::remove_col(int)’:
cpp_code/src/Cluster.cpp:169:10: warning: deleting object of polymorphic class type ‘ComponentModel’ which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor]
delete p_cm;
^
cpp_code/src/Cluster.cpp: In member function ‘double Cluster::calc_column_predictive_logp(std::vector<double>, std::string, std::vector<int>, CM_Hypers)’:
cpp_code/src/Cluster.cpp:128:31: warning: ‘p_cm’ may be used uninitialized in this function [-Wmaybe-uninitialized]
p_cm->insert_element(value);
^
cpp_code/src/Cluster.cpp: In member function ‘double Cluster::insert_col(std::vector<double>, std::string, std::vector<int>, CM_Hypers&)’:
cpp_code/src/Cluster.cpp:180:19: warning: ‘p_cm’ may be used uninitialized in this function [-Wmaybe-uninitialized]
ComponentModel *p_cm;
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cpp_code/src/MultinomialComponentModel.cpp: In member function ‘virtual double MultinomialComponentModel::calc_element_predictive_logp_constrained(double, std::vector<double>) const’:
cpp_code/src/MultinomialComponentModel.cpp:77:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int constraint_idx=0; constraint_idx<constraints.size();
^
cpp_code/src/MultinomialComponentModel.cpp: In member function ‘virtual std::vector<double> MultinomialComponentModel::calc_hyper_conditionals(std::string, std::vector<double>) const’:
cpp_code/src/MultinomialComponentModel.cpp:98:10: warning: unused variable ‘dirichlet_alpha’ [-Wunused-variable]
double dirichlet_alpha = hyper_dirichlet_alpha;
^
cpp_code/src/MultinomialComponentModel.cpp: In member function ‘virtual void MultinomialComponentModel::init_suffstats()’:
cpp_code/src/MultinomialComponentModel.cpp:151:10: warning: unused variable ‘dirichlet_alpha’ [-Wunused-variable]
double dirichlet_alpha = hyper_dirichlet_alpha;
^
cpp_code/src/MultinomialComponentModel.cpp: In member function ‘void MultinomialComponentModel::get_keys_counts_for_draw(std::vector<std::basic_string<char> >&, std::vector<double>&, std::map<std::basic_string<char>, double>) const’:
cpp_code/src/MultinomialComponentModel.cpp:161:7: warning: unused variable ‘K’ [-Wunused-variable]
int K = hyper_K;
^
cpp_code/src/MultinomialComponentModel.cpp: In member function ‘double MultinomialComponentModel::get_draw_constrained(int, std::vector<double>) const’:
cpp_code/src/MultinomialComponentModel.cpp:209:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int constraint_idx=0; constraint_idx<constraints.size(); constraint_idx++) {
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cpp_code/src/ContinuousComponentModel.cpp: In member function ‘virtual double ContinuousComponentModel::calc_element_predictive_logp_constrained(double, std::vector<double>) const’:
cpp_code/src/ContinuousComponentModel.cpp:90:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int constraint_idx=0; constraint_idx<constraints.size();
^
cpp_code/src/ContinuousComponentModel.cpp: In member function ‘double ContinuousComponentModel::get_draw_constrained(int, std::vector<double>) const’:
cpp_code/src/ContinuousComponentModel.cpp:212:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int constraint_idx=0; constraint_idx<constraints.size();
^
cpp_code/src/ContinuousComponentModel.cpp: In member function ‘double ContinuousComponentModel::get_predictive_cdf(double, std::vector<double>) const’:
cpp_code/src/ContinuousComponentModel.cpp:240:61: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int constraint_idx=0; constraint_idx<constraints.size();
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
running install
running build
running build_py
running build_ext
skipping 'crosscat/cython_code/ContinuousComponentModel.cpp' Cython extension (up-to-date)
building 'crosscat.cython_code.ContinuousComponentModel' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c crosscat/cython_code/ContinuousComponentModel.cpp -o build/temp.linux-x86_64-2.7/crosscat/cython_code/ContinuousComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/utils.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/numerics.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/RandomNumberGenerator.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/ComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/ContinuousComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/ContinuousComponentModel.o
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/crosscat/cython_code/ContinuousComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/ContinuousComponentModel.o -lboost_random -o build/lib.linux-x86_64-2.7/crosscat/cython_code/ContinuousComponentModel.so
skipping 'crosscat/cython_code/MultinomialComponentModel.cpp' Cython extension (up-to-date)
building 'crosscat.cython_code.MultinomialComponentModel' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c crosscat/cython_code/MultinomialComponentModel.cpp -o build/temp.linux-x86_64-2.7/crosscat/cython_code/MultinomialComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/utils.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/numerics.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/RandomNumberGenerator.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/ComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/MultinomialComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/MultinomialComponentModel.o
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/crosscat/cython_code/MultinomialComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/MultinomialComponentModel.o -lboost_random -o build/lib.linux-x86_64-2.7/crosscat/cython_code/MultinomialComponentModel.so
cythoning crosscat/cython_code/State.pyx to crosscat/cython_code/State.cpp
building 'crosscat.cython_code.State' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c crosscat/cython_code/State.cpp -o build/temp.linux-x86_64-2.7/crosscat/cython_code/State.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/utils.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/numerics.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/RandomNumberGenerator.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/DateTime.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/DateTime.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/View.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/View.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/Cluster.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/Cluster.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/ComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/MultinomialComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/MultinomialComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/ContinuousComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/ContinuousComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/State.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/State.o
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/crosscat/cython_code/State.o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o build/temp.linux-x86_64-2.7/cpp_code/src/DateTime.o build/temp.linux-x86_64-2.7/cpp_code/src/View.o build/temp.linux-x86_64-2.7/cpp_code/src/Cluster.o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/MultinomialComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/ContinuousComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/State.o -lboost_random -o build/lib.linux-x86_64-2.7/crosscat/cython_code/State.so
running install_lib
copying build/lib.linux-x86_64-2.7/crosscat/cython_code/MultinomialComponentModel.so -> /usr/local/lib/python2.7/dist-packages/crosscat/cython_code
copying build/lib.linux-x86_64-2.7/crosscat/cython_code/ContinuousComponentModel.so -> /usr/local/lib/python2.7/dist-packages/crosscat/cython_code
copying build/lib.linux-x86_64-2.7/crosscat/cython_code/State.so -> /usr/local/lib/python2.7/dist-packages/crosscat/cython_code
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/CrossCat-0.1.egg-info
Writing /usr/local/lib/python2.7/dist-packages/CrossCat-0.1.egg-info
# http://stackoverflow.com/a/938800
import os
_proc_status = '/proc/%d/status' % os.getpid()
_scale = {'kB': 1024.0, 'mB': 1024.0*1024.0,
'KB': 1024.0, 'MB': 1024.0*1024.0}
def _VmB(VmKey):
'''Private.
'''
global _proc_status, _scale
# get pseudo file /proc/<pid>/status
try:
t = open(_proc_status)
v = t.read()
t.close()
except:
return 0.0 # non-Linux?
# get VmKey line e.g. 'VmRSS: 9999 kB\n ...'
i = v.index(VmKey)
v = v[i:].split(None, 3) # whitespace
if len(v) < 3:
return 0.0 # invalid format?
# convert Vm value to bytes
return float(v[1]) * _scale[v[2]]
def memory(since=0.0):
'''Return memory usage in bytes.
'''
return _VmB('VmSize:') - since
def resident(since=0.0):
'''Return resident memory usage in bytes.
'''
return _VmB('VmRSS:') - since
def stacksize(since=0.0):
'''Return stack size in bytes.
'''
return _VmB('VmStk:') - since
commits="1360023db0e1f639 SHOW_DIAGNOSTICS"
git_dir=/opt/crosscat
script_name=test_local_engine.py
for commit in $commits; do
(cd $git_dir && git checkout ${commit})
(cd $git_dir && sudo python setup.py install) >${commit}_setup.out 2>${commit}_setup.err
python $script_name >${commit}_out 2>${commit}_err
done
creating local engine
done initialize
done analyze
done del; gc.collect()
creating local engine 0.00390625
done initialize 7.49609375
done analyze 3.7109375
done del; gc.collect() -4.1875
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
In file included from /usr/include/python2.7/numpy/ndarrayobject.h:26:0,
from /usr/include/python2.7/numpy/arrayobject.h:14,
from crosscat/cython_code/State.cpp:262:
/usr/include/python2.7/numpy/__multiarray_api.h:1532:1: warning: ‘int _import_array()’ defined but not used [-Wunused-function]
_import_array(void)
^
In file included from /usr/include/python2.7/numpy/ufuncobject.h:152:0,
from crosscat/cython_code/State.cpp:263:
/usr/include/python2.7/numpy/__ufunc_api.h:226:1: warning: ‘int _import_umath()’ defined but not used [-Wunused-function]
_import_umath(void)
^
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
running install
running build
running build_py
running build_ext
skipping 'crosscat/cython_code/ContinuousComponentModel.cpp' Cython extension (up-to-date)
building 'crosscat.cython_code.ContinuousComponentModel' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c crosscat/cython_code/ContinuousComponentModel.cpp -o build/temp.linux-x86_64-2.7/crosscat/cython_code/ContinuousComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/utils.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/numerics.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/RandomNumberGenerator.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/ComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/ContinuousComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/ContinuousComponentModel.o
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/crosscat/cython_code/ContinuousComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/ContinuousComponentModel.o -lboost_random -o build/lib.linux-x86_64-2.7/crosscat/cython_code/ContinuousComponentModel.so
skipping 'crosscat/cython_code/MultinomialComponentModel.cpp' Cython extension (up-to-date)
building 'crosscat.cython_code.MultinomialComponentModel' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c crosscat/cython_code/MultinomialComponentModel.cpp -o build/temp.linux-x86_64-2.7/crosscat/cython_code/MultinomialComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/utils.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/numerics.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/RandomNumberGenerator.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/ComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/MultinomialComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/MultinomialComponentModel.o
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/crosscat/cython_code/MultinomialComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/MultinomialComponentModel.o -lboost_random -o build/lib.linux-x86_64-2.7/crosscat/cython_code/MultinomialComponentModel.so
cythoning crosscat/cython_code/State.pyx to crosscat/cython_code/State.cpp
building 'crosscat.cython_code.State' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c crosscat/cython_code/State.cpp -o build/temp.linux-x86_64-2.7/crosscat/cython_code/State.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/utils.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/numerics.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/RandomNumberGenerator.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/DateTime.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/DateTime.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/View.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/View.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/Cluster.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/Cluster.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/ComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/MultinomialComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/MultinomialComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/ContinuousComponentModel.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/ContinuousComponentModel.o
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Icpp_code/include/CrossCat -I/usr/include/python2.7 -c cpp_code/src/State.cpp -o build/temp.linux-x86_64-2.7/cpp_code/src/State.o
g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/crosscat/cython_code/State.o build/temp.linux-x86_64-2.7/cpp_code/src/utils.o build/temp.linux-x86_64-2.7/cpp_code/src/numerics.o build/temp.linux-x86_64-2.7/cpp_code/src/RandomNumberGenerator.o build/temp.linux-x86_64-2.7/cpp_code/src/DateTime.o build/temp.linux-x86_64-2.7/cpp_code/src/View.o build/temp.linux-x86_64-2.7/cpp_code/src/Cluster.o build/temp.linux-x86_64-2.7/cpp_code/src/ComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/MultinomialComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/ContinuousComponentModel.o build/temp.linux-x86_64-2.7/cpp_code/src/State.o -lboost_random -o build/lib.linux-x86_64-2.7/crosscat/cython_code/State.so
running install_lib
copying build/lib.linux-x86_64-2.7/crosscat/cython_code/MultinomialComponentModel.so -> /usr/local/lib/python2.7/dist-packages/crosscat/cython_code
copying build/lib.linux-x86_64-2.7/crosscat/cython_code/ContinuousComponentModel.so -> /usr/local/lib/python2.7/dist-packages/crosscat/cython_code
copying build/lib.linux-x86_64-2.7/crosscat/cython_code/State.so -> /usr/local/lib/python2.7/dist-packages/crosscat/cython_code
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/CrossCat-0.1.egg-info
Writing /usr/local/lib/python2.7/dist-packages/CrossCat-0.1.egg-info
import numpy
#
import crosscat.LocalEngine as LE
import crosscat.utils.data_utils as du
import mem_usage as mu
data_filename = '/opt/crosscat/www/data/dha.csv'
#
gen_seed = 0
n_chains = 2
# num_transitions = 5
num_transitions = 10
T, M_r, M_c = du.read_model_data_from_csv(data_filename, gen_seed=gen_seed)
#
memory_usages = []
messages = []
memory_usage = mu.memory()
memory_usages.append(memory_usage)
engine = LE.LocalEngine()
message = 'creating local engine'
print message
messages.append(message)
memory_usage = mu.memory()
memory_usages.append(memory_usage)
X_L, X_D = engine.initialize(M_c, M_r, T, 'from_the_prior', n_chains=n_chains)
message = 'done initialize'
print message
messages.append(message)
memory_usage = mu.memory()
memory_usages.append(memory_usage)
X_L, X_D = engine.analyze(M_c, T, X_L, X_D, n_steps=num_transitions)
message = 'done analyze'
print message
messages.append(message)
memory_usage = mu.memory()
memory_usages.append(memory_usage)
# this seems to work! But always uses last job of memory?
del X_L, X_D, M_c, M_r, T
import gc; gc.collect()
message = 'done del; gc.collect()'
print message
messages.append(message)
memory_usage = mu.memory()
memory_usages.append(memory_usage)
def get_memory_diffs(memory_usages):
memory_usages = numpy.array(memory_usages, dtype=int) / (1024. * 1024.)
memory_diffs = numpy.diff(memory_usages)
return memory_diffs
memory_diffs = get_memory_diffs(memory_usages)
for message, diff in zip(messages, memory_diffs):
print message, diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment