├── .gitignore ├── BINARY_README ├── CMakeLists.txt ├── Doxyfile ├── Doxyfile_internal ├── README.md ├── README_graphlab.md ├── TUTORIALS.md ├── apps ├── CMakeLists.txt ├── cascades │ ├── CMakeLists.txt │ └── cascades.cpp ├── concomp │ ├── CMakeLists.txt │ └── concomp.cpp ├── example │ ├── CMakeLists.txt │ ├── hello_world.cpp │ └── word_search.cpp └── label_propagation │ ├── CMakeLists.txt │ └── label_propagation.cpp ├── cmake ├── FindAnt.cmake ├── FindBoost.cmake ├── FindCUDA.cmake ├── FindCUDA │ ├── make2cmake.cmake │ ├── parse_cubin.cmake │ └── run_nvcc.cmake ├── FindLibJpeg.cmake ├── FindMPICH2.cmake ├── FindMatlab.cmake ├── FindPerftools.cmake ├── Mex_stub.cpp └── mex_link.sh ├── configure ├── cxxtest ├── cxxtest │ ├── Descriptions.cpp │ ├── Descriptions.h │ ├── DummyDescriptions.cpp │ ├── DummyDescriptions.h │ ├── ErrorFormatter.h │ ├── ErrorPrinter.h │ ├── Flags.h │ ├── GlobalFixture.cpp │ ├── GlobalFixture.h │ ├── Gui.h │ ├── LinkedList.cpp │ ├── LinkedList.h │ ├── Mock.h │ ├── ParenPrinter.h │ ├── QtGui.h │ ├── RealDescriptions.cpp │ ├── RealDescriptions.h │ ├── Root.cpp │ ├── SelfTest.h │ ├── StdHeaders.h │ ├── StdTestSuite.h │ ├── StdValueTraits.h │ ├── StdioFilePrinter.h │ ├── StdioPrinter.h │ ├── TeeListener.h │ ├── TestListener.h │ ├── TestMain.h │ ├── TestRunner.h │ ├── TestSuite.cpp │ ├── TestSuite.h │ ├── TestTracker.cpp │ ├── TestTracker.h │ ├── ValueTraits.cpp │ ├── ValueTraits.h │ ├── Win32Gui.h │ ├── X11Gui.h │ ├── XUnitPrinter.h │ ├── XmlFormatter.h │ ├── XmlPrinter.h │ ├── YesNoRunner.h │ ├── __init__.py │ ├── __release__.py │ ├── cxx_parser.py │ ├── cxxtest_fog.py │ ├── cxxtest_misc.py │ ├── cxxtest_parser.py │ └── cxxtestgen.py ├── cxxtestgen └── python │ ├── README.txt │ ├── convert.py │ ├── cxxtest │ ├── __init__.py │ ├── __release__.py │ ├── cxx_parser.py │ ├── cxxtest_fog.py │ ├── cxxtest_misc.py │ ├── cxxtest_parser.py │ └── cxxtestgen.py │ ├── python3 │ ├── cxxtest │ │ ├── __init__.py │ │ ├── __release__.py │ │ ├── cxx_parser.py │ │ ├── cxxtest_fog.py │ │ ├── cxxtest_misc.py │ │ ├── cxxtest_parser.py │ │ └── cxxtestgen.py │ └── scripts │ │ └── cxxtestgen │ ├── scripts │ └── cxxtestgen │ └── setup.py ├── demoapps ├── CMakeLists.txt ├── dsl │ ├── CMakeLists.txt │ ├── gen_impl.cpp │ ├── gl_server.cpp │ ├── graph_typedefs.gen │ ├── impl.graphlab │ └── scala_impl │ │ └── dsl.scala ├── pagerank │ ├── CMakeLists.txt │ ├── simple_pagerank.cpp │ ├── warp_engine_pagerank.cpp │ └── warp_parfor_pagerank.cpp └── rpc │ ├── CMakeLists.txt │ ├── dht_performance_test.cpp │ ├── fiber_future_test.cpp │ ├── obj_fiber_future_test.cpp │ ├── rpc_call_perf_test.cpp │ ├── rpc_example1.cpp │ ├── rpc_example2.cpp │ ├── rpc_example3.cpp │ ├── rpc_example4.cpp │ ├── rpc_example5.cpp │ ├── rpc_example6.cpp │ ├── rpc_example7.cpp │ ├── rpc_example8.cpp │ └── rpc_example9.cpp ├── dist └── README ├── doc ├── README └── images │ ├── cycle_triangle.dot │ ├── cycle_triangle.gif │ ├── example_webgraph.dot │ ├── example_webgraph.gif │ ├── factor_graph_to_distributed_graph.png │ ├── factor_graph_to_distributed_graph.svg │ ├── graph_format_example.dot │ ├── graph_format_example.gif │ ├── images.pptx │ ├── in_triangle.dot │ ├── in_triangle.gif │ ├── noisy_img.jpeg │ ├── orig_img.jpeg │ ├── out_triangle.dot │ ├── out_triangle.gif │ ├── partition_fig.gif │ ├── potts_model.png │ ├── pred_img.jpeg │ ├── software_stack.png │ ├── system_overview.png │ ├── through_triangle.dot │ ├── through_triangle.gif │ ├── triangle_strong_community.png │ └── triangle_weak_community.png ├── images ├── 800px-PageRank-hi-res-300x215.png ├── Slide1.jpg ├── als_eqn.gif ├── cloudcv-1024x489.png ├── collaborative_filtering.jpg ├── gl_os_software_stack.png ├── hybrid_cut.png ├── hybrid_engine.png ├── kcore2-300x300.jpg ├── kmeans1.gif ├── panorama-1024x251.png ├── r-300x278.jpg ├── topic-300x179.gif ├── triangle_strong_community-150x150.jpg └── triangle_weak_community-150x150.jpg ├── license ├── LICENSE.txt ├── LICENSE_prepend.txt ├── corporate_CLA.txt └── individual_CLA.txt ├── matlab └── eventlog_parser.m ├── patches ├── boost.patch ├── libbz2_fpic.patch ├── libevent_clean_and_remap.sh ├── libevent_remap_file.txt ├── libhdfs.patch ├── libjson.patch ├── opencv_apple_rpath.patch ├── tcmalloc.patch └── zookeeper │ ├── Makefile │ └── configure ├── scripts ├── add_line_to_eof.sh ├── binary_list.txt ├── build_linux_static.sh ├── build_linux_static_no_jvm.sh ├── build_linux_static_no_jvm_no_mpi.sh ├── build_osx_static.sh ├── compile_static_release.sh ├── ec2 │ ├── benchmark_ec2.sh │ ├── gl-ec2 │ ├── gl_ec2.py │ ├── readme │ └── third_party │ │ └── boto-2.4.1.zip ├── ec2_tools │ ├── scatter │ ├── setup-hadoop │ └── setup-torque ├── install_graphlab.sh ├── license_prepend.sh ├── linux_run_script_no_jvm_template.sh ├── linux_run_script_template.sh ├── make_all_docs.sh ├── make_dist.sh ├── mpi_redirect_stdout.sh ├── mpirsync ├── rpcexec.py └── test_dist.sh ├── src ├── CMakeLists.txt ├── graphlab.hpp └── graphlab │ ├── CMakeLists.txt │ ├── aggregation │ ├── CMakeLists.txt │ ├── aggregation_includes.hpp │ └── distributed_aggregator.hpp │ ├── docs │ ├── faq.dox │ ├── overview.dox │ ├── using.dox │ └── using_warp.dox │ ├── engine │ ├── CMakeLists.txt │ ├── async_consistent_engine.hpp │ ├── distributed_chandy_misra.hpp │ ├── engine_includes.hpp │ ├── execution_status.hpp │ ├── iengine.hpp │ ├── message_array.hpp │ ├── omni_engine.hpp │ ├── powerlyra_async_engine.hpp │ ├── powerlyra_sync_engine.hpp │ ├── synchronous_engine.hpp │ ├── warp_engine.hpp │ ├── warp_graph_broadcast.hpp │ ├── warp_graph_mapreduce.hpp │ ├── warp_graph_transform.hpp │ └── warp_parfor_all_vertices.hpp │ ├── graph │ ├── CMakeLists.txt │ ├── builtin_parsers.hpp │ ├── distributed_graph.hpp │ ├── dynamic_local_graph.hpp │ ├── graph_basic_types.hpp │ ├── graph_formats.dox │ ├── graph_gather_apply.hpp │ ├── graph_hash.hpp │ ├── graph_includes.hpp │ ├── graph_ops.hpp │ ├── graph_storage_deprecated.hpp │ ├── graph_vertex_join.hpp │ ├── ingress │ │ ├── distributed_batch_ingress.hpp │ │ ├── distributed_bipartite_affinity_ingress.hpp │ │ ├── distributed_bipartite_aweto_ingress.hpp │ │ ├── distributed_bipartite_random_ingress.hpp │ │ ├── distributed_constrained_batch_ingress.hpp │ │ ├── distributed_constrained_oblivious_ingress.hpp │ │ ├── distributed_constrained_random_ingress.hpp │ │ ├── distributed_hybrid_ginger_ingress.hpp │ │ ├── distributed_hybrid_ingress.hpp │ │ ├── distributed_identity_ingress.hpp │ │ ├── distributed_ingress_base.hpp │ │ ├── distributed_oblivious_ingress.hpp │ │ ├── distributed_random_ingress.hpp │ │ ├── ingress_edge_decision.hpp │ │ └── sharding_constraint.hpp │ ├── local_edge_buffer.hpp │ ├── local_graph.hpp │ ├── local_graph_ops.hpp │ └── vertex_set.hpp │ ├── jni │ ├── CMakeLists.txt │ ├── java_any.cpp │ ├── java_any.hpp │ ├── org_graphlab_Aggregator.cpp │ ├── org_graphlab_Aggregator.h │ ├── org_graphlab_Aggregator.hpp │ ├── org_graphlab_Context.cpp │ ├── org_graphlab_Context.h │ ├── org_graphlab_Context.hpp │ ├── org_graphlab_Core.cpp │ ├── org_graphlab_Core.h │ ├── org_graphlab_Core.hpp │ ├── org_graphlab_Updater.cpp │ ├── org_graphlab_Updater.h │ └── org_graphlab_Updater.hpp │ ├── logger │ ├── CMakeLists.txt │ ├── assertions.hpp │ ├── assertions.hpp.orig │ ├── backtrace.cpp │ ├── backtrace.hpp │ ├── fail_method.hpp │ ├── logger.cpp │ ├── logger.hpp │ └── logger_includes.hpp │ ├── macros_def.hpp │ ├── macros_undef.hpp │ ├── options │ ├── CMakeLists.txt │ ├── command_line_options.cpp │ ├── command_line_options.hpp │ ├── engine_help.txt │ ├── graph_help.txt │ ├── graphlab_options.hpp │ ├── options_includes.hpp │ ├── options_map.cpp │ └── options_map.hpp │ ├── parallel │ ├── CMakeLists.txt │ ├── atomic.hpp │ ├── atomic_add_vector2_empty_specialization.hpp │ ├── atomic_ops.hpp │ ├── cache_line_pad.hpp │ ├── deferred_rwlock.hpp │ ├── fiber_barrier.hpp │ ├── fiber_conditional.hpp │ ├── fiber_control.cpp │ ├── fiber_control.hpp │ ├── fiber_group.cpp │ ├── fiber_group.hpp │ ├── fiber_remote_request.hpp │ ├── lockfree_push_back.hpp │ ├── mutex.hpp │ ├── parallel_includes.hpp │ ├── pthread_tools.cpp │ ├── pthread_tools.hpp │ ├── queued_rwlock.hpp │ ├── thread_pool.cpp │ └── thread_pool.hpp │ ├── rpc │ ├── CMakeLists.txt │ ├── async_consensus.cpp │ ├── async_consensus.hpp │ ├── buffered_exchange.hpp │ ├── caching_dht.hpp │ ├── circular_char_buffer.cpp │ ├── circular_char_buffer.hpp │ ├── circular_iovec_buffer.hpp │ ├── dc.cpp │ ├── dc.hpp │ ├── dc_buffered_stream_send2.cpp │ ├── dc_buffered_stream_send2.hpp │ ├── dc_comm_base.hpp │ ├── dc_compile_parameters.hpp │ ├── dc_dist_object.hpp │ ├── dc_dist_object_base.hpp │ ├── dc_init_from_env.cpp │ ├── dc_init_from_env.hpp │ ├── dc_init_from_mpi.cpp │ ├── dc_init_from_mpi.hpp │ ├── dc_init_from_zookeeper.cpp │ ├── dc_init_from_zookeeper.hpp │ ├── dc_internal_types.hpp │ ├── dc_packet_mask.hpp │ ├── dc_receive.hpp │ ├── dc_send.hpp │ ├── dc_services.hpp │ ├── dc_stream_receive.cpp │ ├── dc_stream_receive.hpp │ ├── dc_tcp_comm.cpp │ ├── dc_tcp_comm.hpp │ ├── dc_thread_get_send_buffer.hpp │ ├── dc_types.hpp │ ├── delta_dht.cpp │ ├── delta_dht.hpp │ ├── dht.hpp │ ├── distributed_event_log.cpp │ ├── distributed_event_log.hpp │ ├── evwrapdef.h │ ├── evwrapundef.h │ ├── fiber_async_consensus.cpp │ ├── fiber_async_consensus.hpp │ ├── fiber_buffered_exchange.hpp │ ├── function_arg_types_def.hpp │ ├── function_arg_types_undef.hpp │ ├── function_broadcast_issue.hpp │ ├── function_call_dispatch.hpp │ ├── function_call_issue.hpp │ ├── function_ret_type.hpp │ ├── get_current_process_hash.cpp │ ├── get_current_process_hash.hpp │ ├── is_rpc_call.hpp │ ├── lazy_dht.hpp │ ├── mem_function_arg_types_def.hpp │ ├── mem_function_arg_types_undef.hpp │ ├── object_broadcast_issue.hpp │ ├── object_call_dispatch.hpp │ ├── object_call_issue.hpp │ ├── object_request_dispatch.hpp │ ├── object_request_issue.hpp │ ├── pod_template_structs.hpp │ ├── request_dispatch.hpp │ ├── request_future.hpp │ ├── request_issue.hpp │ ├── request_reply_handler.cpp │ ├── request_reply_handler.hpp │ ├── rpc.dox │ ├── rpc_includes.hpp │ ├── sample_sort.hpp │ ├── thread_local_send_buffer.cpp │ └── thread_local_send_buffer.hpp │ ├── scheduler │ ├── CMakeLists.txt │ ├── fifo_scheduler.cpp │ ├── fifo_scheduler.hpp │ ├── get_message_priority.hpp │ ├── ischeduler.hpp │ ├── priority_scheduler.cpp │ ├── priority_scheduler.hpp │ ├── queued_fifo_scheduler.cpp │ ├── queued_fifo_scheduler.hpp │ ├── scheduler_factory.hpp │ ├── scheduler_includes.hpp │ ├── scheduler_list.cpp │ ├── scheduler_list.hpp │ ├── sweep_scheduler.cpp │ └── sweep_scheduler.hpp │ ├── serialization │ ├── CMakeLists.txt │ ├── basic_types.hpp │ ├── conditional_serialize.hpp │ ├── has_load.hpp │ ├── has_save.hpp │ ├── iarchive.hpp │ ├── is_pod.hpp │ ├── iterator.hpp │ ├── list.hpp │ ├── map.hpp │ ├── oarchive.hpp │ ├── serializable_concept.hpp │ ├── serializable_pod.hpp │ ├── serialization.dox │ ├── serialization_includes.hpp │ ├── serialize.hpp │ ├── serialize_to_from_string.hpp │ ├── set.hpp │ ├── unordered_map.hpp │ ├── unordered_set.hpp │ ├── unsupported_serialize.hpp │ └── vector.hpp │ ├── ui │ ├── CMakeLists.txt │ ├── graphlab_visualization.js │ ├── index.html │ ├── intel_demo │ │ ├── graph_builder.json │ │ ├── graphlab_visualization.js │ │ ├── index.html │ │ └── style.css │ ├── metrics_server.cpp │ ├── metrics_server.hpp │ ├── mongoose │ │ ├── CMakeLists.txt │ │ ├── LICENSE │ │ ├── mongoose.cpp │ │ └── mongoose.h │ └── style.css │ ├── util │ ├── CMakeLists.txt │ ├── binary_parser.hpp │ ├── blocking_queue.hpp │ ├── bloom_filter.hpp │ ├── branch_hints.hpp │ ├── cache.hpp │ ├── chandy_misra.hpp │ ├── chandy_misra2.hpp │ ├── chandy_misra_lockfree.hpp │ ├── char_counting_sink.hpp │ ├── charstream.hpp │ ├── cuckoo_map.hpp │ ├── cuckoo_map_pow2.hpp │ ├── cuckoo_set_pow2.hpp │ ├── dense_bitset.hpp │ ├── empty.hpp │ ├── event_log.cpp │ ├── event_log.hpp │ ├── fast_multinomial.hpp │ ├── fiber_blocking_queue.hpp │ ├── fs_util.cpp │ ├── fs_util.hpp │ ├── generate_pds.hpp │ ├── generics │ │ ├── CMakeLists.txt │ │ ├── any.cpp │ │ ├── any.hpp │ │ ├── blob.hpp │ │ ├── block_linked_list.hpp │ │ ├── conditional_addition_wrapper.hpp │ │ ├── conditional_combiner_wrapper.hpp │ │ ├── counting_sort.hpp │ │ ├── csr_storage.hpp │ │ ├── dynamic_block.hpp │ │ ├── dynamic_csr_storage.hpp │ │ ├── float_selector.hpp │ │ ├── integer_selector.hpp │ │ ├── remove_member_pointer.hpp │ │ ├── robust_cast.hpp │ │ ├── shuffle.hpp │ │ ├── test_function_or_functor_type.hpp │ │ └── vector_zip.hpp │ ├── hash_functions.hpp │ ├── hashstream.hpp │ ├── hdfs.cpp │ ├── hdfs.hpp │ ├── hopscotch_map.hpp │ ├── hopscotch_set.hpp │ ├── hopscotch_table.hpp │ ├── inplace_lf_queue.cpp │ ├── inplace_lf_queue.hpp │ ├── inplace_lf_queue2.hpp │ ├── integer_mix.hpp │ ├── integer_selector.hpp │ ├── lock_free_internal.hpp │ ├── lock_free_pool.hpp │ ├── memory_info.cpp │ ├── memory_info.hpp │ ├── mpi_tools.cpp │ ├── mpi_tools.hpp │ ├── mutable_queue.hpp │ ├── net_util.cpp │ ├── net_util.hpp │ ├── random.cpp │ ├── random.hpp │ ├── resizing_array_sink.hpp │ ├── safe_circular_char_buffer.cpp │ ├── safe_circular_char_buffer.hpp │ ├── small_map.hpp │ ├── small_set.hpp │ ├── stl_util.hpp │ ├── synchronized_unordered_map.hpp │ ├── synchronized_unordered_map2.hpp │ ├── system_usage.hpp │ ├── tetrad.hpp │ ├── timer.cpp │ ├── timer.hpp │ ├── tracepoint.cpp │ ├── tracepoint.hpp │ ├── triple.hpp │ ├── uint128.hpp │ ├── union_find.hpp │ ├── util_includes.hpp │ ├── web_util.cpp │ └── web_util.hpp │ ├── version.hpp │ ├── vertex_program │ ├── CMakeLists.txt │ ├── context.hpp │ ├── icontext.hpp │ ├── ivertex_program.hpp │ ├── messages.hpp │ ├── op_plus_eq_concept.hpp │ └── vertex_program_includes.hpp │ ├── warp.hpp │ └── zookeeper │ ├── key_value.cpp │ ├── key_value.hpp │ ├── server_list.cpp │ ├── server_list.hpp │ ├── zookeeper_common.cpp │ └── zookeeper_common.hpp ├── tests ├── CMakeLists.txt ├── arbitrary_signal_test.cpp ├── async_consistent_test.cpp ├── chandy_misra.cxx ├── csr_storage_test.cxx ├── cuckootest.cpp ├── data │ ├── CMakeLists.txt │ ├── test_adj │ │ └── test.adj │ ├── test_snap │ │ └── test.snap │ └── test_tsv │ │ └── test.tsv ├── dc_consensus_test.cpp ├── dc_fiber_consensus_test.cpp ├── dc_test_sequentialization.cpp ├── dcsc_test.cpp ├── dense_bitset_test.cxx ├── dht_performance_test.cpp ├── distributed_chandy_misra_test.cpp ├── distributed_graph_test.cpp ├── distributed_ingress_test.cpp ├── empty_test.cxx ├── engine_terminator_bench.cxx ├── fiber_test.cpp ├── fibo_fiber_test.cpp ├── hdfs_test.cpp ├── hopscotch_test.cpp ├── local_graph_test.cxx ├── lock_free_pushback.cxx ├── mini_web_server.cpp ├── random_test.cxx ├── runtests.sh ├── scheduler_test.cxx ├── serializetests.cxx ├── sfinae_function_test.cpp ├── simulate_powerlaw_replica.cpp ├── small_map_test.cxx ├── small_set_test.cxx ├── sort_test.cpp ├── synchronous_engine_test.cpp ├── test_lock_free_pool.cxx ├── test_parsers.cpp ├── test_vertex_set.cpp ├── thread_tools.cxx └── union_find_test.cxx └── toolkits ├── CMakeLists.txt ├── README.md ├── clustering ├── CMakeLists.txt ├── clustering.dox ├── generate_synthetic.cpp ├── graph_laplacian_for_sc.cpp ├── kmeans.cpp └── spectral_clustering.cpp ├── collaborative_filtering ├── CMakeLists.txt ├── adpredictor.cpp ├── als.cpp ├── biassgd.cpp ├── cdf.hpp ├── collaborative_filtering.dox ├── cosamp.hpp ├── doc.cpp ├── eigen_serialization.hpp ├── eigen_wrapper.hpp ├── implicit.hpp ├── make_synthetic_als_data.cpp ├── math.hpp ├── nmf.cpp ├── printouts.hpp ├── sgd.cpp ├── sparse_als.cpp ├── stats.hpp ├── svd.cpp ├── svdpp.cpp ├── types.hpp ├── wals.cpp ├── warp_als_coord.cpp └── warp_nmf.cpp ├── computer_vision ├── CMakeLists.txt ├── computer_vision.dox ├── eigen_serialization.cpp ├── eigen_serialization.hpp ├── gcgraph.hpp ├── grabcut.cpp ├── opencv_serialization.cpp ├── opencv_serialization.hpp ├── precomp.hpp ├── seam_finders_gr.hpp ├── stitch_full_main.cpp ├── stitch_grlab.hpp ├── stitch_main.cpp ├── stitch_main.hpp ├── stitch_opts.hpp ├── stitching.cpp ├── stitching_detailed.cpp └── utils.hpp ├── extensions ├── CMakeLists.txt ├── MurmurHash3.cpp ├── MurmurHash3.h ├── example.txt ├── extension.cpp ├── extension_data.hpp ├── extension_gas.hpp ├── extension_gas_base_types.hpp ├── extension_gas_lambda_wrapper.hpp ├── extension_graph.cpp ├── extension_graph.hpp ├── extension_main.cpp ├── extension_main.hpp ├── extension_pagerank.cpp ├── extensions.hpp └── pagerank_extension_driver.cpp ├── graph_algorithms ├── CMakeLists.txt ├── betweeness.cpp ├── closeness.cpp ├── djikstra.cpp ├── graph_analytics.dox └── prestige.cpp ├── graph_analytics ├── CMakeLists.txt ├── TSC.cpp ├── approximate_diameter.cpp ├── connected_component.cpp ├── connected_component_stats.cpp ├── degree_ordered_coloring.cpp ├── directed_triangle_count.cpp ├── eigen_vector_normalization.cpp ├── format_convert.cpp ├── graph_analytics.dox ├── graph_laplacian.cpp ├── http │ ├── index.html │ ├── make_jsons.m │ ├── style.css │ ├── top_users.json │ └── twitter_triangles.js ├── kcore.cpp ├── pagerank.cpp ├── partitioning.cpp ├── saturation_ordered_coloring.cpp ├── simple_coloring.cpp ├── simple_undirected_triangle_count.cpp ├── sssp.cpp ├── undirected_triangle_count.cpp ├── warp_bond_percolation.cpp ├── warp_coloring.cpp ├── warp_pagerank.cpp └── warp_pagerank2.cpp ├── graphical_models ├── CMakeLists.txt ├── ad3_qp.hpp ├── dd_grlab.hpp ├── dd_main.cpp ├── dd_main.hpp ├── dd_opts.hpp ├── deprecated │ ├── factors │ │ ├── CMakeLists.txt │ │ ├── binary_factor.cpp │ │ ├── binary_factor.hpp │ │ ├── discrete_variable.cpp │ │ ├── factor_includes.hpp │ │ ├── factor_test.cxx │ │ ├── unary_factor.cpp │ │ └── unary_factor.hpp │ ├── gibbs_sampling │ │ ├── CMakeLists.txt │ │ ├── README │ │ ├── chromatic_sampler.cpp │ │ ├── chromatic_sampler.hpp │ │ ├── factorized_model.cpp │ │ ├── factorized_model.hpp │ │ ├── global_variables.cpp │ │ ├── global_variables.hpp │ │ ├── image.cpp │ │ ├── image.hpp │ │ ├── jt_splash_sampler.cpp │ │ ├── jt_splash_sampler.hpp │ │ ├── junction_tree.cpp │ │ ├── junction_tree.hpp │ │ ├── make_denoise_alchemy.cpp │ │ ├── matlab │ │ │ ├── Makefile │ │ │ ├── asg2ind.m │ │ │ ├── compile_gibbs_sampler.m │ │ │ ├── gibbs_sampler.m │ │ │ ├── gibbs_sampler_impl.cpp │ │ │ ├── ind2asg.m │ │ │ ├── matwrap.hpp │ │ │ ├── table_factor.m │ │ │ └── tests │ │ │ │ ├── denoise_test.m │ │ │ │ ├── make_grid_model.m │ │ │ │ ├── small_test.m │ │ │ │ └── small_test2.m │ │ ├── mrf.cpp │ │ ├── mrf.hpp │ │ ├── pgibbs_tls.cpp │ │ ├── pgibbs_tls.hpp │ │ ├── run_statistics.hpp │ │ ├── sampler.cpp │ │ ├── util.cpp │ │ └── util.hpp │ ├── kernelbp │ │ ├── CMakeLists.txt │ │ └── old │ │ │ ├── BallTreeDensity.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── cpp │ │ │ ├── BallTree.h │ │ │ ├── BallTreeClass.cc │ │ │ ├── BallTreeDensity.h │ │ │ ├── BallTreeDensityClass.cc │ │ │ ├── NOTICE │ │ │ └── kernels.h │ │ │ ├── denoise.cpp │ │ │ ├── fakemex.h │ │ │ ├── image.hpp │ │ │ ├── kde.h │ │ │ ├── prob.hpp │ │ │ └── prodSampleEpsilon.hpp │ └── loopybp_denoise.cpp ├── eigen_serialization.cpp ├── eigen_serialization.hpp ├── factors │ ├── CMakeLists.txt │ ├── bp_graph_data.h │ ├── bp_vertex_program.hpp │ ├── dense_table.hpp │ ├── discrete_assignment.hpp │ ├── discrete_bounds.hpp │ ├── discrete_domain.hpp │ ├── discrete_variable.hpp │ ├── factor_graph.hpp │ ├── factor_graphs.dox │ ├── fast_discrete_assignment.hpp │ ├── sparse_index.hpp │ ├── sparse_table.hpp │ ├── table_base.hpp │ ├── table_factor.hpp │ └── tests │ │ ├── CMakeLists.txt │ │ ├── denoise │ │ ├── CMakeLists.txt │ │ ├── denoise.cpp │ │ ├── denoised_gm.png │ │ └── noisy_img.png │ │ ├── test_MAD_relation │ │ ├── CMakeLists.txt │ │ └── test_MAD_relation.cpp │ │ ├── test_bool_var │ │ ├── CMakeLists.txt │ │ ├── test_bool_var.cpp │ │ └── test_cat_bool_joint.cpp │ │ ├── test_dense_table │ │ ├── CMakeLists.txt │ │ └── test_dense_table.cpp │ │ └── test_sparse_table │ │ ├── CMakeLists.txt │ │ ├── test_neg_relation.cpp │ │ └── test_sparse_table.cpp ├── graphical_models.dox ├── lbp_structured_prediction.cpp ├── mplp_denoise.cpp ├── mplp_structured_prediction.cpp ├── profile_lbp_synthetic.cpp ├── profile_lbp_synthetic2.cpp ├── synthetic_image_data.cpp └── utils.hpp ├── linear_solvers ├── CMakeLists.txt ├── jacobi.cpp └── linear_solvers.dox ├── toolkits.dox └── topic_modeling ├── CMakeLists.txt ├── cgs_lda.cpp ├── cgs_lda_mimno_experimental.cpp ├── deprecated ├── cgs_lda.cpp ├── cvb0_lda_common.cpp ├── cvb0_lda_common.hpp └── fast_cvb0_lda.cpp ├── http ├── index.html ├── lda_visualizer.js ├── style.css └── wordclouds ├── lda_sequential_cgs.cpp └── topic_modeling.dox /.gitignore: -------------------------------------------------------------------------------- 1 | # use glob syntax 2 | syntax: glob 3 | 4 | *~ 5 | debug/* 6 | release/* 7 | profile/* 8 | dist/graphlabapi* 9 | doc/doxygen/* 10 | doc/doxygen_internal/* 11 | deps/* 12 | configure.deps 13 | config.log 14 | new_news.txt 15 | cxxtest/cxxtest/*.pyc 16 | 17 | extapis/java_jni/dist 18 | extapis/java_jni/bin 19 | 20 | demoapps/coloring/matlab_tools/*.tsv 21 | demoapps/shortest_path/matlab_tools/*.tsv 22 | demoapps/pagerank/matlab_tools/*.tsv 23 | 24 | tags 25 | *swp 26 | \.mchg\.mchg 27 | .ycm_extra_conf* 28 | -------------------------------------------------------------------------------- /apps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | # link_libraries(${Boost_LIBRARIES}) 4 | # link_libraries(${GraphLab_LIBRARIES}) 5 | 6 | 7 | 8 | macro(add_all_subdirectories retval curdir) 9 | file(GLOB sub-dir RELATIVE ${curdir} *) 10 | set(list_of_dirs "") 11 | foreach(dir ${sub-dir}) 12 | if(IS_DIRECTORY ${curdir}/${dir}) 13 | STRING(SUBSTRING ${dir} 0 1 firstchar) 14 | if(${firstchar} STREQUAL "." OR ${firstchar} STREQUAL "_" ) 15 | else(${firstchar} STREQUAL "." OR ${firstchar} STREQUAL "_") 16 | set(list_of_dirs ${list_of_dirs} ${dir}) 17 | message(STATUS "Detected App: " ${dir}) 18 | add_subdirectory(${dir}) 19 | endif() 20 | endif() 21 | endforeach() 22 | set(${retval} ${list_of_dirs}) 23 | endmacro() 24 | 25 | add_all_subdirectories(retval, ${CMAKE_CURRENT_SOURCE_DIR}) 26 | 27 | -------------------------------------------------------------------------------- /apps/cascades/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(cascades) 2 | add_graphlab_executable(cascades cascades.cpp) 3 | -------------------------------------------------------------------------------- /apps/concomp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(example) 2 | add_graphlab_executable(concomp concomp.cpp) 3 | -------------------------------------------------------------------------------- /apps/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(example) 2 | add_graphlab_executable(hello_world hello_world.cpp) 3 | 4 | project(word_search) 5 | add_graphlab_executable(word_search word_search.cpp) 6 | -------------------------------------------------------------------------------- /apps/label_propagation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(label_propagation) 2 | add_graphlab_executable(label_propagation label_propagation.cpp) 3 | -------------------------------------------------------------------------------- /cmake/FindAnt.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find Ant 2 | find_file(ANT_EXEC NAMES ant ant.sh ant.bat PATHS $ENV{ANT_HOME}/bin) 3 | 4 | INCLUDE(FindPackageHandleStandardArgs) 5 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(ANT DEFAULT_MSG ANT_EXEC) 6 | 7 | MARK_AS_ADVANCED(ANT_EXEC) -------------------------------------------------------------------------------- /cmake/Mex_stub.cpp: -------------------------------------------------------------------------------- 1 | // Adopted from: http://www.cmake.org/Wiki/images/7/72/Mex_stub.cpp 2 | // and tutorial: http://www.cmake.org/Wiki/CMake:MatlabMex 3 | // on June 9, 2010 (akyrola) 4 | 5 | #include "mex.h" 6 | 7 | 8 | extern void __mexFunction__(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]); 9 | extern void __at_exit__(); 10 | 11 | static void at_exit(); 12 | 13 | void mexFunction(int nlhs, mxArray *plhs[], 14 | int nrhs, const mxArray *prhs[]) 15 | { 16 | 17 | mexAtExit(&at_exit); 18 | 19 | __mexFunction__(nlhs, plhs, nrhs, prhs); 20 | 21 | } 22 | 23 | static void at_exit() 24 | { 25 | __at_exit__(); 26 | } 27 | -------------------------------------------------------------------------------- /cmake/mex_link.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | OUTPUT=$1 4 | STATIC_LIB_NAME=$OUTPUT 5 | MOVE_LOCATION=$2 6 | BASEDIR=$3 7 | LINKFILES=$4 8 | LINKER_FLAGS= -shared -Wl,--version-script,/afs/cs.cmu.edu/misc/matlab/amd64_f7/7.9/lib/matlab7/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined 9 | 10 | echo $OUTPUT 11 | echo $STATIC_LIB_NAME 12 | 13 | 14 | 15 | echo 'Running godawful mex linking hack...' 16 | # mex_stub.o compiled with: 17 | g++ -g -Wall -fPIC -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread -DMATLAB_MEX_FILE -lmx -lmex -lmat -lm -I/afs/cs.cmu.edu/local/matlab/amd64_f7/7.9/lib/matlab7/extern/include -c ${BASEDIR}/cmake/Mex_stub.cpp -o mex_stub.o 18 | mex -g -cxx CC='gcc' CXX='g++' LD='g++' -L./ -lglib-2.0 -l$STATIC_LIB_NAME $LINKER_FLAGS -output $OUTPUT mex_stub.o $LINKFILES 19 | #mv $OUTPUT.mexa64 $MOVE_LOCATION 20 | 21 | #-lpthread -lgthread-2.0 -lrt -DMX_COMPAT_32 -------------------------------------------------------------------------------- /cxxtest/cxxtest/GlobalFixture.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------- 3 | CxxTest: A lightweight C++ unit testing library. 4 | Copyright (c) 2008 Sandia Corporation. 5 | This software is distributed under the LGPL License v2.1 6 | For more information, see the COPYING file in the top CxxTest directory. 7 | Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | the U.S. Government retains certain rights in this software. 9 | ------------------------------------------------------------------------- 10 | */ 11 | 12 | #ifndef __cxxtest__GlobalFixture_cpp__ 13 | #define __cxxtest__GlobalFixture_cpp__ 14 | 15 | #include 16 | 17 | namespace CxxTest 18 | { 19 | bool GlobalFixture::setUpWorld() { return true; } 20 | bool GlobalFixture::tearDownWorld() { return true; } 21 | bool GlobalFixture::setUp() { return true; } 22 | bool GlobalFixture::tearDown() { return true; } 23 | 24 | GlobalFixture::GlobalFixture() { attach( _list ); } 25 | GlobalFixture::~GlobalFixture() { detach( _list ); } 26 | 27 | GlobalFixture *GlobalFixture::firstGlobalFixture() { return (GlobalFixture *)_list.head(); } 28 | GlobalFixture *GlobalFixture::lastGlobalFixture() { return (GlobalFixture *)_list.tail(); } 29 | GlobalFixture *GlobalFixture::nextGlobalFixture() { return (GlobalFixture *)next(); } 30 | GlobalFixture *GlobalFixture::prevGlobalFixture() { return (GlobalFixture *)prev(); } 31 | } 32 | 33 | #endif // __cxxtest__GlobalFixture_cpp__ 34 | 35 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/GlobalFixture.h: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------- 3 | CxxTest: A lightweight C++ unit testing library. 4 | Copyright (c) 2008 Sandia Corporation. 5 | This software is distributed under the LGPL License v2.1 6 | For more information, see the COPYING file in the top CxxTest directory. 7 | Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | the U.S. Government retains certain rights in this software. 9 | ------------------------------------------------------------------------- 10 | */ 11 | 12 | #ifndef __cxxtest__GlobalFixture_h__ 13 | #define __cxxtest__GlobalFixture_h__ 14 | 15 | #include 16 | 17 | namespace CxxTest 18 | { 19 | class GlobalFixture : public Link 20 | { 21 | public: 22 | virtual bool setUpWorld(); 23 | virtual bool tearDownWorld(); 24 | virtual bool setUp(); 25 | virtual bool tearDown(); 26 | 27 | GlobalFixture(); 28 | ~GlobalFixture(); 29 | 30 | static GlobalFixture *firstGlobalFixture(); 31 | static GlobalFixture *lastGlobalFixture(); 32 | GlobalFixture *nextGlobalFixture(); 33 | GlobalFixture *prevGlobalFixture(); 34 | 35 | private: 36 | static List _list; 37 | }; 38 | } 39 | 40 | #endif // __cxxtest__GlobalFixture_h__ 41 | 42 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/ParenPrinter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------- 3 | CxxTest: A lightweight C++ unit testing library. 4 | Copyright (c) 2008 Sandia Corporation. 5 | This software is distributed under the LGPL License v2.1 6 | For more information, see the COPYING file in the top CxxTest directory. 7 | Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | the U.S. Government retains certain rights in this software. 9 | ------------------------------------------------------------------------- 10 | */ 11 | 12 | #ifndef __cxxtest__ParenPrinter_h__ 13 | #define __cxxtest__ParenPrinter_h__ 14 | 15 | // 16 | // The ParenPrinter is identical to the ErrorPrinter, except it 17 | // prints the line number in a format expected by some compilers 18 | // (notably, MSVC). 19 | // 20 | 21 | #include 22 | 23 | namespace CxxTest 24 | { 25 | class ParenPrinter : public ErrorPrinter 26 | { 27 | public: 28 | ParenPrinter( CXXTEST_STD(ostream) &o = CXXTEST_STD(cout) ) : ErrorPrinter( o, "(", ")" ) {} 29 | }; 30 | } 31 | 32 | #endif // __cxxtest__ParenPrinter_h__ 33 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/Root.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------- 3 | CxxTest: A lightweight C++ unit testing library. 4 | Copyright (c) 2008 Sandia Corporation. 5 | This software is distributed under the LGPL License v2.1 6 | For more information, see the COPYING file in the top CxxTest directory. 7 | Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | the U.S. Government retains certain rights in this software. 9 | ------------------------------------------------------------------------- 10 | */ 11 | 12 | #ifndef __cxxtest__Root_cpp__ 13 | #define __cxxtest__Root_cpp__ 14 | 15 | // 16 | // This file holds the "root" of CxxTest, i.e. 17 | // the parts that must be in a source file file. 18 | // 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #endif // __cxxtest__Root_cpp__ 30 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/SelfTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------- 3 | CxxTest: A lightweight C++ unit testing library. 4 | Copyright (c) 2008 Sandia Corporation. 5 | This software is distributed under the LGPL License v2.1 6 | For more information, see the COPYING file in the top CxxTest directory. 7 | Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | the U.S. Government retains certain rights in this software. 9 | ------------------------------------------------------------------------- 10 | */ 11 | 12 | #ifndef __cxxtest_SelfTest_h__ 13 | #define __cxxtest_SelfTest_h__ 14 | 15 | #define CXXTEST_SUITE(name) 16 | #define CXXTEST_CODE(member) 17 | 18 | #endif // __cxxtest_SelfTest_h__ 19 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/StdHeaders.h: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------- 3 | CxxTest: A lightweight C++ unit testing library. 4 | Copyright (c) 2008 Sandia Corporation. 5 | This software is distributed under the LGPL License v2.1 6 | For more information, see the COPYING file in the top CxxTest directory. 7 | Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | the U.S. Government retains certain rights in this software. 9 | ------------------------------------------------------------------------- 10 | */ 11 | 12 | #ifndef __cxxtest_StdHeaders_h__ 13 | #define __cxxtest_StdHeaders_h__ 14 | 15 | // 16 | // This file basically #includes the STL headers. 17 | // It exists to support warning level 4 in Visual C++ 18 | // 19 | 20 | #ifdef _MSC_VER 21 | # pragma warning( push, 1 ) 22 | #endif // _MSC_VER 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #ifdef _MSC_VER 33 | # pragma warning( pop ) 34 | #endif // _MSC_VER 35 | 36 | #endif // __cxxtest_StdHeaders_h__ 37 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/StdioPrinter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------- 3 | CxxTest: A lightweight C++ unit testing library. 4 | Copyright (c) 2008 Sandia Corporation. 5 | This software is distributed under the LGPL License v2.1 6 | For more information, see the COPYING file in the top CxxTest directory. 7 | Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | the U.S. Government retains certain rights in this software. 9 | ------------------------------------------------------------------------- 10 | */ 11 | 12 | #ifndef __cxxtest__StdioPrinter_h__ 13 | #define __cxxtest__StdioPrinter_h__ 14 | 15 | // 16 | // The StdioPrinter is an StdioFilePrinter which defaults to stdout. 17 | // This should have been called StdOutPrinter or something, but the name 18 | // has been historically used. 19 | // 20 | 21 | #include 22 | 23 | namespace CxxTest 24 | { 25 | class StdioPrinter : public StdioFilePrinter 26 | { 27 | public: 28 | StdioPrinter( FILE *o = stdout, const char *preLine = ":", const char *postLine = "" ) : 29 | StdioFilePrinter( o, preLine, postLine ) {} 30 | }; 31 | } 32 | 33 | #endif // __cxxtest__StdioPrinter_h__ 34 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/XUnitPrinter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------- 3 | CxxTest: A lightweight C++ unit testing library. 4 | Copyright (c) 2008 Sandia Corporation. 5 | This software is distributed under the LGPL License v2.1 6 | For more information, see the COPYING file in the top CxxTest directory. 7 | Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | the U.S. Government retains certain rights in this software. 9 | ------------------------------------------------------------------------- 10 | */ 11 | 12 | #ifndef __CXXTEST__XUNIT_PRINTER_H 13 | #define __CXXTEST__XUNIT_PRINTER_H 14 | 15 | // 16 | // XUnitPrinter combines an ErrorPrinter with an XML formatter. 17 | // 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace CxxTest 24 | { 25 | class XUnitPrinter : public TeeListener 26 | { 27 | public: 28 | 29 | XmlPrinter xml_printer; 30 | ErrorPrinter error_printer; 31 | 32 | XUnitPrinter( CXXTEST_STD(ostream) &o = CXXTEST_STD(cout) ) 33 | : xml_printer(o) 34 | { 35 | setFirst( error_printer ); 36 | setSecond( xml_printer ); 37 | } 38 | 39 | int run() 40 | { 41 | TestRunner::runAllTests( *this ); 42 | return tracker().failedTests(); 43 | } 44 | }; 45 | } 46 | 47 | #endif //__CXXTEST__XUNIT_PRINTER_H 48 | 49 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/YesNoRunner.h: -------------------------------------------------------------------------------- 1 | /* 2 | ------------------------------------------------------------------------- 3 | CxxTest: A lightweight C++ unit testing library. 4 | Copyright (c) 2008 Sandia Corporation. 5 | This software is distributed under the LGPL License v2.1 6 | For more information, see the COPYING file in the top CxxTest directory. 7 | Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | the U.S. Government retains certain rights in this software. 9 | ------------------------------------------------------------------------- 10 | */ 11 | 12 | #ifndef __cxxtest__YesNoRunner_h__ 13 | #define __cxxtest__YesNoRunner_h__ 14 | 15 | // 16 | // The YesNoRunner is a simple TestListener that 17 | // just returns true iff all tests passed. 18 | // 19 | 20 | #include 21 | #include 22 | 23 | namespace CxxTest 24 | { 25 | class YesNoRunner : public TestListener 26 | { 27 | public: 28 | YesNoRunner() 29 | { 30 | } 31 | 32 | int run() 33 | { 34 | TestRunner::runAllTests( *this ); 35 | return tracker().failedTests(); 36 | } 37 | }; 38 | } 39 | 40 | #endif // __cxxtest__YesNoRunner_h__ 41 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/__init__.py: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------- 2 | # CxxTest: A lightweight C++ unit testing library. 3 | # Copyright (c) 2008 Sandia Corporation. 4 | # This software is distributed under the LGPL License v2.1 5 | # For more information, see the COPYING file in the top CxxTest directory. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | #------------------------------------------------------------------------- 9 | 10 | """cxxtest: A Python package that supports the CxxTest test framework for C/C++. 11 | 12 | .. _CxxTest: http://cxxtest.tigris.org/ 13 | 14 | CxxTest is a unit testing framework for C++ that is similar in 15 | spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because 16 | it does not require precompiling a CxxTest testing library, it 17 | employs no advanced features of C++ (e.g. RTTI) and it supports a 18 | very flexible form of test discovery. 19 | 20 | The cxxtest Python package includes capabilities for parsing C/C++ source files and generating 21 | CxxTest drivers. 22 | """ 23 | 24 | from cxxtest.__release__ import __version__, __date__ 25 | __date__ 26 | __version__ 27 | 28 | __maintainer__ = "William E. Hart" 29 | __maintainer_email__ = "whart222@gmail.com" 30 | __license__ = "LGPL" 31 | __url__ = "http://cxxtest.tigris.org/" 32 | 33 | from cxxtest.cxxtestgen import * 34 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/__release__.py: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------- 2 | # CxxTest: A lightweight C++ unit testing library. 3 | # Copyright (c) 2008 Sandia Corporation. 4 | # This software is distributed under the LGPL License v2.1 5 | # For more information, see the COPYING file in the top CxxTest directory. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | #------------------------------------------------------------------------- 9 | 10 | """ Release Information for cxxtest """ 11 | 12 | __version__ = '4.0.2' 13 | __date__ = "2012-01-02" 14 | -------------------------------------------------------------------------------- /cxxtest/cxxtest/cxxtest_misc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #------------------------------------------------------------------------- 3 | # CxxTest: A lightweight C++ unit testing library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the LGPL License v2.1 6 | # For more information, see the COPYING file in the top CxxTest directory. 7 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | # the U.S. Government retains certain rights in this software. 9 | #------------------------------------------------------------------------- 10 | 11 | import sys 12 | 13 | def abort( problem ): 14 | '''Print error message and exit''' 15 | sys.stderr.write( '\n' ) 16 | sys.stderr.write( problem ) 17 | sys.stderr.write( '\n\n' ) 18 | sys.exit(2) 19 | 20 | -------------------------------------------------------------------------------- /cxxtest/cxxtestgen: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # 3 | # The CxxTest driver script, which uses the cxxtest Python package. 4 | # 5 | 6 | import sys 7 | import os 8 | from os.path import realpath, dirname 9 | if sys.version_info < (3,0): 10 | sys.path.insert(0, dirname(dirname(realpath(__file__)))+os.sep+'python') 11 | else: 12 | sys.path.insert(0, dirname(dirname(realpath(__file__)))+os.sep+'python'+os.sep+'python3') 13 | sys.path.append(".") 14 | 15 | import cxxtest 16 | 17 | cxxtest.main(sys.argv) 18 | 19 | -------------------------------------------------------------------------------- /cxxtest/python/README.txt: -------------------------------------------------------------------------------- 1 | CxxTest Python Package 2 | ====================== 3 | 4 | The CxxTest Python package includes utilities that are used by the 5 | CxxTest unit testing framework. Specifically, this Python package 6 | supports C++ parsing and code generation done in the cxxtestgen 7 | script. 8 | 9 | -------------------------------------------------------------------------------- /cxxtest/python/convert.py: -------------------------------------------------------------------------------- 1 | # 2 | # Execute this script to copy the cxxtest/*.py files 3 | # and run 2to3 to convert them to Python 3. 4 | # 5 | 6 | import glob 7 | import subprocess 8 | import os 9 | import shutil 10 | 11 | os.chdir('cxxtest') 12 | for file in glob.glob('*.py'): 13 | shutil.copyfile(file, '../python3/cxxtest/'+file) 14 | # 15 | os.chdir('../python3/cxxtest') 16 | # 17 | for file in glob.glob('*.py'): 18 | subprocess.call('2to3 -w '+file, shell=True) 19 | 20 | -------------------------------------------------------------------------------- /cxxtest/python/cxxtest/__init__.py: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------- 2 | # CxxTest: A lightweight C++ unit testing library. 3 | # Copyright (c) 2008 Sandia Corporation. 4 | # This software is distributed under the LGPL License v2.1 5 | # For more information, see the COPYING file in the top CxxTest directory. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | #------------------------------------------------------------------------- 9 | 10 | """cxxtest: A Python package that supports the CxxTest test framework for C/C++. 11 | 12 | .. _CxxTest: http://cxxtest.tigris.org/ 13 | 14 | CxxTest is a unit testing framework for C++ that is similar in 15 | spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because 16 | it does not require precompiling a CxxTest testing library, it 17 | employs no advanced features of C++ (e.g. RTTI) and it supports a 18 | very flexible form of test discovery. 19 | 20 | The cxxtest Python package includes capabilities for parsing C/C++ source files and generating 21 | CxxTest drivers. 22 | """ 23 | 24 | from cxxtest.__release__ import __version__, __date__ 25 | __date__ 26 | __version__ 27 | 28 | __maintainer__ = "William E. Hart" 29 | __maintainer_email__ = "whart222@gmail.com" 30 | __license__ = "LGPL" 31 | __url__ = "http://cxxtest.tigris.org/" 32 | 33 | from cxxtest.cxxtestgen import * 34 | -------------------------------------------------------------------------------- /cxxtest/python/cxxtest/__release__.py: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------- 2 | # CxxTest: A lightweight C++ unit testing library. 3 | # Copyright (c) 2008 Sandia Corporation. 4 | # This software is distributed under the LGPL License v2.1 5 | # For more information, see the COPYING file in the top CxxTest directory. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | #------------------------------------------------------------------------- 9 | 10 | """ Release Information for cxxtest """ 11 | 12 | __version__ = '4.0.2' 13 | __date__ = "2012-01-02" 14 | -------------------------------------------------------------------------------- /cxxtest/python/cxxtest/cxxtest_misc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #------------------------------------------------------------------------- 3 | # CxxTest: A lightweight C++ unit testing library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the LGPL License v2.1 6 | # For more information, see the COPYING file in the top CxxTest directory. 7 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | # the U.S. Government retains certain rights in this software. 9 | #------------------------------------------------------------------------- 10 | 11 | import sys 12 | 13 | def abort( problem ): 14 | '''Print error message and exit''' 15 | sys.stderr.write( '\n' ) 16 | sys.stderr.write( problem ) 17 | sys.stderr.write( '\n\n' ) 18 | sys.exit(2) 19 | 20 | -------------------------------------------------------------------------------- /cxxtest/python/python3/cxxtest/__init__.py: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------- 2 | # CxxTest: A lightweight C++ unit testing library. 3 | # Copyright (c) 2008 Sandia Corporation. 4 | # This software is distributed under the LGPL License v2.1 5 | # For more information, see the COPYING file in the top CxxTest directory. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | #------------------------------------------------------------------------- 9 | 10 | """cxxtest: A Python package that supports the CxxTest test framework for C/C++. 11 | 12 | .. _CxxTest: http://cxxtest.tigris.org/ 13 | 14 | CxxTest is a unit testing framework for C++ that is similar in 15 | spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because 16 | it does not require precompiling a CxxTest testing library, it 17 | employs no advanced features of C++ (e.g. RTTI) and it supports a 18 | very flexible form of test discovery. 19 | 20 | The cxxtest Python package includes capabilities for parsing C/C++ source files and generating 21 | CxxTest drivers. 22 | """ 23 | 24 | from cxxtest.__release__ import __version__, __date__ 25 | __date__ 26 | __version__ 27 | 28 | __maintainer__ = "William E. Hart" 29 | __maintainer_email__ = "whart222@gmail.com" 30 | __license__ = "LGPL" 31 | __url__ = "http://cxxtest.tigris.org/" 32 | 33 | from cxxtest.cxxtestgen import * 34 | -------------------------------------------------------------------------------- /cxxtest/python/python3/cxxtest/__release__.py: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------- 2 | # CxxTest: A lightweight C++ unit testing library. 3 | # Copyright (c) 2008 Sandia Corporation. 4 | # This software is distributed under the LGPL License v2.1 5 | # For more information, see the COPYING file in the top CxxTest directory. 6 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 7 | # the U.S. Government retains certain rights in this software. 8 | #------------------------------------------------------------------------- 9 | 10 | """ Release Information for cxxtest """ 11 | 12 | __version__ = '4.0.2' 13 | __date__ = "2012-01-02" 14 | -------------------------------------------------------------------------------- /cxxtest/python/python3/cxxtest/cxxtest_misc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #------------------------------------------------------------------------- 3 | # CxxTest: A lightweight C++ unit testing library. 4 | # Copyright (c) 2008 Sandia Corporation. 5 | # This software is distributed under the LGPL License v2.1 6 | # For more information, see the COPYING file in the top CxxTest directory. 7 | # Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 8 | # the U.S. Government retains certain rights in this software. 9 | #------------------------------------------------------------------------- 10 | 11 | import sys 12 | 13 | def abort( problem ): 14 | '''Print error message and exit''' 15 | sys.stderr.write( '\n' ) 16 | sys.stderr.write( problem ) 17 | sys.stderr.write( '\n\n' ) 18 | sys.exit(2) 19 | 20 | -------------------------------------------------------------------------------- /cxxtest/python/python3/scripts/cxxtestgen: -------------------------------------------------------------------------------- 1 | #! python 2 | 3 | import cxxtest.cxxtestgen 4 | 5 | cxxtest.cxxtestgen.main() 6 | -------------------------------------------------------------------------------- /cxxtest/python/scripts/cxxtestgen: -------------------------------------------------------------------------------- 1 | #! python 2 | 3 | import cxxtest.cxxtestgen 4 | 5 | cxxtest.cxxtestgen.main() 6 | -------------------------------------------------------------------------------- /cxxtest/python/setup.py: -------------------------------------------------------------------------------- 1 | """ 2 | Script to generate the installer for cxxtest. 3 | """ 4 | 5 | classifiers = """\ 6 | Development Status :: 4 - Beta 7 | Intended Audience :: End Users/Desktop 8 | License :: OSI Approved :: LGPL License 9 | Natural Language :: English 10 | Operating System :: Microsoft :: Windows 11 | Operating System :: Unix 12 | Programming Language :: Python 13 | Topic :: Software Development :: Libraries :: Python Modules 14 | """ 15 | 16 | import os 17 | import sys 18 | from os.path import realpath, dirname 19 | if sys.version_info >= (3,0): 20 | sys.path.insert(0, dirname(realpath(__file__))+os.sep+'python3') 21 | os.chdir('python3') 22 | 23 | import cxxtest 24 | 25 | try: 26 | from setuptools import setup 27 | except ImportError: 28 | from distutils.core import setup 29 | 30 | doclines = cxxtest.__doc__.split("\n") 31 | 32 | setup(name="cxxtest", 33 | version=cxxtest.__version__, 34 | maintainer=cxxtest.__maintainer__, 35 | maintainer_email=cxxtest.__maintainer_email__, 36 | url = cxxtest.__url__, 37 | license = cxxtest.__license__, 38 | platforms = ["any"], 39 | description = doclines[0], 40 | classifiers = filter(None, classifiers.split("\n")), 41 | long_description = "\n".join(doclines[2:]), 42 | packages=['cxxtest'], 43 | keywords=['utility'], 44 | scripts=['scripts/cxxtestgen'] 45 | # 46 | # The entry_points option is not supported by distutils.core 47 | # 48 | #entry_points=""" 49 | #[console_scripts] 50 | #cxxtestgen = cxxtest.cxxtestgen:main 51 | #""" 52 | ) 53 | 54 | -------------------------------------------------------------------------------- /demoapps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | # link_libraries(${Boost_LIBRARIES}) 4 | # link_libraries(${GraphLab_LIBRARIES}) 5 | 6 | 7 | 8 | macro(add_all_subdirectories retval curdir) 9 | file(GLOB sub-dir RELATIVE ${curdir} *) 10 | set(list_of_dirs "") 11 | foreach(dir ${sub-dir}) 12 | if(IS_DIRECTORY ${curdir}/${dir}) 13 | STRING(SUBSTRING ${dir} 0 1 firstchar) 14 | if(${firstchar} STREQUAL "." OR ${firstchar} STREQUAL "_" ) 15 | else(${firstchar} STREQUAL "." OR ${firstchar} STREQUAL "_") 16 | set(list_of_dirs ${list_of_dirs} ${dir}) 17 | message(STATUS "Detected demo app: " ${dir}) 18 | add_subdirectory(${dir}) 19 | endif() 20 | endif() 21 | endforeach() 22 | set(${retval} ${list_of_dirs}) 23 | endmacro() 24 | 25 | add_all_subdirectories(retval, ${CMAKE_CURRENT_SOURCE_DIR}) 26 | 27 | -------------------------------------------------------------------------------- /demoapps/dsl/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | # add_graphlab_executable(gl_server gl_server.cpp) 4 | 5 | # add_library(gen_impl SHARED gen_impl.cpp) 6 | -------------------------------------------------------------------------------- /demoapps/dsl/gen_impl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | #include "graph_typedefs.gen" 27 | 28 | using namespace graphlab; 29 | 30 | #define ALPHA 0.87 31 | 32 | extern "C" void user_program(user_funs* f) { 33 | float prev = f->get_vertex_data(); 34 | float neighbors = f->reduce_neighbors(IN_EDGES); 35 | //neighbors = neighbors/out_edges 36 | float curr = ALPHA*neighbors + (1-ALPHA); 37 | f->set_vertex_data(curr); 38 | float last_change = std::abs(curr - prev); 39 | std::cout << "last change was: " << last_change << std::endl; 40 | if (last_change > 0.01) { 41 | f->signal_neighbors(OUT_EDGES); 42 | } 43 | std::cout.flush(); 44 | } 45 | 46 | extern "C" void vertex_reduce(vertex_data_type& a, const vertex_data_type& b) { 47 | a += b; 48 | } 49 | 50 | -------------------------------------------------------------------------------- /demoapps/dsl/graph_typedefs.gen: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | typedef float vertex_data_type; 6 | typedef float edge_data_type; 7 | 8 | typedef struct { 9 | void* ctx; 10 | void* vtx; 11 | vertex_data_type get_vertex_data() { 12 | return _get_vertex_data(vtx); 13 | } 14 | void set_vertex_data(vertex_data_type vd) { 15 | _set_vertex_data(vd,vtx); 16 | } 17 | vertex_data_type reduce_neighbors(graphlab::edge_dir_type e) { 18 | return _reduce_neighbors(e,ctx); 19 | } 20 | void signal_neighbors(graphlab::edge_dir_type e) { 21 | _signal_neighbors(e,ctx); 22 | } 23 | vertex_data_type (*_get_vertex_data)(void*); 24 | void (*_set_vertex_data)(vertex_data_type&,void*); 25 | //std::vector (*get_neighboring_edges)(); 26 | //std::vector (*get_neighboring_vertices)(); 27 | vertex_data_type (*_reduce_neighbors)(graphlab::edge_dir_type,void*); 28 | void (*_signal_neighbors)(graphlab::edge_dir_type,void*); 29 | //edge_data_type (*reduce_edges)(); 30 | } user_funs; 31 | -------------------------------------------------------------------------------- /demoapps/dsl/impl.graphlab: -------------------------------------------------------------------------------- 1 | types { 2 | vertextype float 3 | edgetype float 4 | } 5 | 6 | 7 | def update() { 8 | //get a local copy of the vertex data 9 | float prev = get_vertex_data() 10 | 11 | //get a sum of the neighbors' values 12 | //uses vertex_reduce defined below 13 | float neighbors = reduce_neighbors(IN_EDGES) 14 | 15 | //calculate updated value 16 | float curr = 0.85*neighbors + 0.15 17 | 18 | //modify our data 19 | set_vertex_data(curr) 20 | 21 | //calculate change 22 | float last_change = curr - prev 23 | if (last_change < 0) { 24 | last_change = -1 * last_change 25 | } 26 | 27 | //signal neighbors 28 | if (last_change > 0.01) { 29 | signal_neighbors(OUT_EDGES) 30 | } 31 | } 32 | 33 | def vertex_reduce(a:vertextype,b:vertextype) { 34 | a += b 35 | } 36 | -------------------------------------------------------------------------------- /demoapps/dsl/scala_impl/dsl.scala: -------------------------------------------------------------------------------- 1 | import scala.util.parsing.combinator.syntactical._ 2 | 3 | 4 | object GLParser extends StandardTokenParsers { 5 | val keywords = List("update","reduce_edges","reduce_vertices","print") 6 | val types = List("bool","int","float") 7 | 8 | lexical.reserved ++= keywords 9 | lexical.reserved ++= types 10 | 11 | lexical.delimiters ++= List("{","}","(",")",".",",","+","-","*","/","<",">","=") 12 | 13 | def numLit:Parser[Int] = opt("-") ~ numericLit ^^ { 14 | case None ~ n => n.toInt 15 | case Some(_) ~ n => (-1)*n.toInt 16 | } 17 | 18 | 19 | 20 | } 21 | -------------------------------------------------------------------------------- /demoapps/pagerank/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | 4 | add_graphlab_executable(simple_pagerank simple_pagerank.cpp) 5 | 6 | add_graphlab_executable(warp_parfor_pagerank warp_parfor_pagerank.cpp) 7 | 8 | add_graphlab_executable(warp_engine_pagerank warp_engine_pagerank.cpp) 9 | -------------------------------------------------------------------------------- /demoapps/rpc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | add_graphlab_executable(rpc_example1 rpc_example1.cpp) 4 | add_graphlab_executable(rpc_example2 rpc_example2.cpp) 5 | add_graphlab_executable(rpc_example3 rpc_example3.cpp) 6 | add_graphlab_executable(rpc_example4 rpc_example4.cpp) 7 | add_graphlab_executable(rpc_example5 rpc_example5.cpp) 8 | add_graphlab_executable(rpc_example6 rpc_example6.cpp) 9 | add_graphlab_executable(rpc_example7 rpc_example7.cpp) 10 | add_graphlab_executable(rpc_example8 rpc_example8.cpp) 11 | add_graphlab_executable(rpc_example9 rpc_example9.cpp) 12 | 13 | #add_graphlab_executable(barrier_test barrier_test.cpp) 14 | add_graphlab_executable(dht_performance_test dht_performance_test.cpp) 15 | 16 | add_graphlab_executable(rpc_call_perf_test rpc_call_perf_test.cpp) 17 | 18 | add_graphlab_executable(fiber_future_test fiber_future_test.cpp) 19 | add_graphlab_executable(obj_fiber_future_test obj_fiber_future_test.cpp) 20 | -------------------------------------------------------------------------------- /demoapps/rpc/rpc_example1.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | using namespace graphlab; 27 | 28 | 29 | void print(int val) { 30 | std::cout << val << std::endl; 31 | } 32 | 33 | int add_one(int val) { 34 | return val + 1; 35 | } 36 | 37 | 38 | int main(int argc, char ** argv) { 39 | // init MPI 40 | global_logger().set_log_level(LOG_INFO); 41 | mpi_tools::init(argc, argv); 42 | distributed_control dc; 43 | 44 | if (dc.numprocs() != 2) { 45 | std::cout<< "RPC Example 1: Basic Synchronous RPC\n"; 46 | std::cout << "Run with exactly 2 MPI nodes.\n"; 47 | return 0; 48 | } 49 | 50 | if (dc.procid() == 0) { 51 | dc.control_call(1, print, 10); 52 | std::cout << "5 plus 1 is : " << dc.remote_request(1, add_one, 5) << std::endl; 53 | std::cout << "11 plus 1 is : " << dc.remote_request(1, add_one, 11) << std::endl; 54 | } 55 | dc.barrier(); 56 | // terminate MPI 57 | mpi_tools::finalize(); 58 | } 59 | 60 | -------------------------------------------------------------------------------- /demoapps/rpc/rpc_example5.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | 25 | #include 26 | #include 27 | #include 28 | using namespace graphlab; 29 | 30 | 31 | int main(int argc, char ** argv) { 32 | mpi_tools::init(argc, argv); 33 | distributed_control dc; 34 | 35 | if (dc.numprocs() != 2) { 36 | 37 | std::cout<< "RPC Example 5: Asynchronous RPC to printf \n"; 38 | std::cout << "Run with exactly 2 MPI nodes.\n"; 39 | return 0; 40 | } 41 | 42 | if (dc.procid() == 0) { 43 | dc.remote_call(1, printf, "%d + %f = %s\n", 1, 2.0, "three"); 44 | } 45 | dc.barrier(); 46 | 47 | mpi_tools::finalize(); 48 | } 49 | -------------------------------------------------------------------------------- /demoapps/rpc/rpc_example6.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | using namespace graphlab; 30 | 31 | 32 | void print(any val) { 33 | val.print(std::cout); 34 | std::cout << std::endl; 35 | } 36 | 37 | 38 | int main(int argc, char ** argv) { 39 | mpi_tools::init(argc, argv); 40 | distributed_control dc; 41 | 42 | if (dc.numprocs() != 2) { 43 | std::cout<< "RPC Example 6: Asynchronous RPC with any \n"; 44 | std::cout << "Run with exactly 2 MPI nodes.\n"; 45 | return 0; 46 | } 47 | 48 | if (dc.procid() == 0) { 49 | dc.remote_call(1, print, any(15)); 50 | dc.remote_call(1, print, any(10.5)); 51 | dc.remote_call(1, print, any(std::string("hello world"))); 52 | } 53 | 54 | int i = dc.procid() == 0 ? 10 : 100; 55 | dc.broadcast(i, dc.procid() == 0); 56 | std::cout << i << std::endl; 57 | assert(i == 10); 58 | 59 | mpi_tools::finalize(); 60 | } 61 | -------------------------------------------------------------------------------- /dist/README: -------------------------------------------------------------------------------- 1 | This folder contains the distribution files created by the make_dist 2 | script in the project root. -------------------------------------------------------------------------------- /doc/README: -------------------------------------------------------------------------------- 1 | To generate docs, run "doxygen" in the graphlab/ directory 2 | Doxygen >= 1.8 recommended 3 | 4 | -------------------------------------------------------------------------------- /doc/images/cycle_triangle.dot: -------------------------------------------------------------------------------- 1 | digraph g{ 2 | A [label="A",style=filled, color=green, shape=circle]; 3 | b [label="", shape=circle]; 4 | c [label="", shape=circle]; 5 | { rank=same; b; c} 6 | nodesep=0.6; 7 | A->b ; 8 | A->c [dir=back]; 9 | b->c ; 10 | } 11 | -------------------------------------------------------------------------------- /doc/images/cycle_triangle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/cycle_triangle.gif -------------------------------------------------------------------------------- /doc/images/example_webgraph.dot: -------------------------------------------------------------------------------- 1 | digraph webgraph { 2 | a [label="1: a.com"]; 3 | b [label="4: b.org"]; 4 | c [label="10: c.edu"]; 5 | d [label="11: d.gov"]; 6 | a->b; 7 | a->c; 8 | b->c; 9 | c->d; 10 | c->a; 11 | d->c; 12 | } 13 | -------------------------------------------------------------------------------- /doc/images/example_webgraph.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/example_webgraph.gif -------------------------------------------------------------------------------- /doc/images/factor_graph_to_distributed_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/factor_graph_to_distributed_graph.png -------------------------------------------------------------------------------- /doc/images/graph_format_example.dot: -------------------------------------------------------------------------------- 1 | digraph webgraph { 2 | a [label="1"]; 3 | b [label="2"]; 4 | c [label="5"]; 5 | d [label="7"]; 6 | a->b; 7 | a->c; 8 | c->d; 9 | d->a; 10 | d->c; 11 | } 12 | -------------------------------------------------------------------------------- /doc/images/graph_format_example.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/graph_format_example.gif -------------------------------------------------------------------------------- /doc/images/images.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/images.pptx -------------------------------------------------------------------------------- /doc/images/in_triangle.dot: -------------------------------------------------------------------------------- 1 | digraph g{ 2 | A [label="A",style=filled, color=green, shape=circle]; 3 | b [label="", shape=circle]; 4 | c [label="", shape=circle]; 5 | { rank=same; b; c} 6 | nodesep=0.6; 7 | A->b [dir=back]; 8 | A->c [dir=back]; 9 | b->c [dir=none,style=dashed]; 10 | } 11 | -------------------------------------------------------------------------------- /doc/images/in_triangle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/in_triangle.gif -------------------------------------------------------------------------------- /doc/images/noisy_img.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/noisy_img.jpeg -------------------------------------------------------------------------------- /doc/images/orig_img.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/orig_img.jpeg -------------------------------------------------------------------------------- /doc/images/out_triangle.dot: -------------------------------------------------------------------------------- 1 | digraph g{ 2 | A [label="A",style=filled, color=green, shape=circle]; 3 | b [label="", shape=circle]; 4 | c [label="", shape=circle]; 5 | { rank=same; b; c} 6 | nodesep=0.6; 7 | A->b; 8 | A->c; 9 | b->c [dir=none,style=dashed]; 10 | } 11 | -------------------------------------------------------------------------------- /doc/images/out_triangle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/out_triangle.gif -------------------------------------------------------------------------------- /doc/images/partition_fig.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/partition_fig.gif -------------------------------------------------------------------------------- /doc/images/potts_model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/potts_model.png -------------------------------------------------------------------------------- /doc/images/pred_img.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/pred_img.jpeg -------------------------------------------------------------------------------- /doc/images/software_stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/software_stack.png -------------------------------------------------------------------------------- /doc/images/system_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/system_overview.png -------------------------------------------------------------------------------- /doc/images/through_triangle.dot: -------------------------------------------------------------------------------- 1 | digraph g{ 2 | A [label="A",style=filled, color=green, shape=circle]; 3 | b [label="", shape=circle]; 4 | c [label="", shape=circle]; 5 | { rank=same; b; c} 6 | nodesep=0.6; 7 | A->b ; 8 | A->c [dir=back]; 9 | c->b ; 10 | } 11 | -------------------------------------------------------------------------------- /doc/images/through_triangle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/through_triangle.gif -------------------------------------------------------------------------------- /doc/images/triangle_strong_community.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/triangle_strong_community.png -------------------------------------------------------------------------------- /doc/images/triangle_weak_community.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/doc/images/triangle_weak_community.png -------------------------------------------------------------------------------- /images/800px-PageRank-hi-res-300x215.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/800px-PageRank-hi-res-300x215.png -------------------------------------------------------------------------------- /images/Slide1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/Slide1.jpg -------------------------------------------------------------------------------- /images/als_eqn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/als_eqn.gif -------------------------------------------------------------------------------- /images/cloudcv-1024x489.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/cloudcv-1024x489.png -------------------------------------------------------------------------------- /images/collaborative_filtering.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/collaborative_filtering.jpg -------------------------------------------------------------------------------- /images/gl_os_software_stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/gl_os_software_stack.png -------------------------------------------------------------------------------- /images/hybrid_cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/hybrid_cut.png -------------------------------------------------------------------------------- /images/hybrid_engine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/hybrid_engine.png -------------------------------------------------------------------------------- /images/kcore2-300x300.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/kcore2-300x300.jpg -------------------------------------------------------------------------------- /images/kmeans1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/kmeans1.gif -------------------------------------------------------------------------------- /images/panorama-1024x251.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/panorama-1024x251.png -------------------------------------------------------------------------------- /images/r-300x278.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/r-300x278.jpg -------------------------------------------------------------------------------- /images/topic-300x179.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/topic-300x179.gif -------------------------------------------------------------------------------- /images/triangle_strong_community-150x150.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/triangle_strong_community-150x150.jpg -------------------------------------------------------------------------------- /images/triangle_weak_community-150x150.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/images/triangle_weak_community-150x150.jpg -------------------------------------------------------------------------------- /license/LICENSE_prepend.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Shanghai Jiao Tong University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://ipads.se.sjtu.edu.cn/projects/powerlyra.html 20 | * 21 | */ 22 | 23 | /* 24 | * Copyright (c) 2009 Carnegie Mellon University. 25 | * All rights reserved. 26 | * 27 | * Licensed under the Apache License, Version 2.0 (the "License"); 28 | * you may not use this file except in compliance with the License. 29 | * You may obtain a copy of the License at 30 | * 31 | * http://www.apache.org/licenses/LICENSE-2.0 32 | * 33 | * Unless required by applicable law or agreed to in writing, 34 | * software distributed under the License is distributed on an "AS 35 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 36 | * express or implied. See the License for the specific language 37 | * governing permissions and limitations under the License. 38 | * 39 | * For more about this software visit: 40 | * 41 | * http://www.graphlab.ml.cmu.edu 42 | * 43 | */ 44 | 45 | 46 | -------------------------------------------------------------------------------- /matlab/eventlog_parser.m: -------------------------------------------------------------------------------- 1 | function ret = eventlog_parser(eventlogfile) 2 | f = fopen(eventlogfile); 3 | res = textscan(f, '%s %f %f %f %f %f %f', 'Delimiter', '\t'); 4 | fclose(f); 5 | names= res{1}; 6 | times = res{2}; 7 | minimum = res{3}; 8 | average = res{4}; 9 | maximum = res{5}; 10 | total = res{6}; 11 | rate = res{7}; 12 | 13 | uniquenames = unique(names); 14 | numentries = length(names); 15 | ret = {}; 16 | if (isempty(uniquenames)) 17 | return 18 | end 19 | 20 | 21 | for i = 1:length(uniquenames) 22 | ret{i} = struct('name', [], ... 23 | 'times', [], ... 24 | 'minimum', [], ... 25 | 'average', [], ... 26 | 'maximum', [], ... 27 | 'total', [], ... 28 | 'rate', []); 29 | 30 | ret{i}.name = uniquenames{i}; 31 | for j = 1:numentries 32 | if (strcmp(uniquenames{i}, names{j})) 33 | ret{i}.times = [ret{i}.times, times(j)]; 34 | ret{i}.minimum = [ret{i}.minimum, minimum(j)]; 35 | ret{i}.average = [ret{i}.average, average(j)]; 36 | ret{i}.maximum = [ret{i}.maximum, maximum(j)]; 37 | ret{i}.total = [ret{i}.total, total(j)]; 38 | ret{i}.rate = [ret{i}.rate , rate(j)]; 39 | end 40 | end 41 | end 42 | end -------------------------------------------------------------------------------- /patches/boost.patch: -------------------------------------------------------------------------------- 1 | diff -rupN boost_1_53_0_old/boost/cstdint.hpp boost_1_53_0/boost/cstdint.hpp 2 | index ea84b65..697b67b 100644 3 | --- boost_1_53_0_old/boost/cstdint.hpp 4 | +++ boost_1_53_0/boost/cstdint.hpp 5 | @@ -39,9 +39,15 @@ 6 | // Note that GLIBC is a bit inconsistent about whether int64_t is defined or not 7 | // depending upon what headers happen to have been included first... 8 | // so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG. 9 | -// See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990 10 | +// See issues: 11 | +// https://svn.boost.org/trac/boost/ticket/3548 12 | +// http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990 13 | +// https://svn.boost.org/trac/boost/ticket/8973 14 | // 15 | -#if defined(BOOST_HAS_STDINT_H) && (!defined(__GLIBC__) || defined(__GLIBC_HAVE_LONG_LONG)) 16 | +#if defined(BOOST_HAS_STDINT_H) \ 17 | + && (!defined(__GLIBC__) \ 18 | + || defined(__GLIBC_HAVE_LONG_LONG) \ 19 | + || (defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 17))))) 20 | 21 | // The following #include is an implementation artifact; not part of interface. 22 | # ifdef __hpux 23 | 24 | -------------------------------------------------------------------------------- /patches/libbz2_fpic.patch: -------------------------------------------------------------------------------- 1 | --- Makefile 2010-09-10 18:46:02.000000000 -0400 2 | +++ Makefile 2012-05-31 13:21:15.211233533 -0400 3 | @@ -21,7 +21,7 @@ 4 | LDFLAGS= 5 | 6 | BIGFILES=-D_FILE_OFFSET_BITS=64 7 | -CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) 8 | +CFLAGS=-fpic -fPIC -Wall -Winline -O2 -g $(BIGFILES) 9 | 10 | # Where you want it installed when you do 'make install' 11 | PREFIX=/usr/local 12 | -------------------------------------------------------------------------------- /patches/libevent_clean_and_remap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ $# -ne 1 ] 3 | then 4 | echo "Missing argument: directory where libevent libraries reside" 5 | exit 1 6 | fi 7 | 8 | CURDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 9 | cd $1 10 | rm -f libevent*.so 11 | objcopy --redefine-syms=$CURDIR/libevent_remap_file.txt libevent_pthreads.a 12 | objcopy --redefine-syms=$CURDIR/libevent_remap_file.txt libevent.a 13 | 14 | -------------------------------------------------------------------------------- /patches/opencv_apple_rpath.patch: -------------------------------------------------------------------------------- 1 | 564a565 2 | > if(APPLE) 3 | 571c572 4 | < INSTALL_NAME_DIR lib 5 | --- 6 | > INSTALL_NAME_DIR "@rpath" 7 | 573c574,581 8 | < 9 | --- 10 | > else() 11 | > set_target_properties(${the_module} PROPERTIES 12 | > OUTPUT_NAME "${the_module}${OPENCV_DLLVERSION}" 13 | > DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" 14 | > ARCHIVE_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_PATH} 15 | > RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} 16 | > INSTALL_NAME_DIR lib) 17 | > endif() 18 | -------------------------------------------------------------------------------- /patches/tcmalloc.patch: -------------------------------------------------------------------------------- 1 | Index: src/base/linux_syscall_support.h 2 | =================================================================== 3 | --- src/base/linux_syscall_support.h (revision 175) 4 | +++ src/base/linux_syscall_support.h (working copy) 5 | @@ -243,14 +243,13 @@ 6 | long ru_nivcsw; 7 | }; 8 | 9 | -struct siginfo; 10 | #if defined(__i386__) || defined(__arm__) || defined(__PPC__) 11 | 12 | /* include/asm-{arm,i386,mips,ppc}/signal.h */ 13 | struct kernel_old_sigaction { 14 | union { 15 | void (*sa_handler_)(int); 16 | - void (*sa_sigaction_)(int, struct siginfo *, void *); 17 | + void (*sa_sigaction_)(int, siginfo_t *, void *); 18 | }; 19 | unsigned long sa_mask; 20 | unsigned long sa_flags; 21 | @@ -287,13 +286,13 @@ 22 | unsigned long sa_flags; 23 | union { 24 | void (*sa_handler_)(int); 25 | - void (*sa_sigaction_)(int, struct siginfo *, void *); 26 | + void (*sa_sigaction_)(int, siginfo_t *, void *); 27 | }; 28 | struct kernel_sigset_t sa_mask; 29 | #else 30 | union { 31 | void (*sa_handler_)(int); 32 | - void (*sa_sigaction_)(int, struct siginfo *, void *); 33 | + void (*sa_sigaction_)(int, siginfo_t *, void *); 34 | }; 35 | unsigned long sa_flags; 36 | void (*sa_restorer)(void); 37 | -------------------------------------------------------------------------------- /patches/zookeeper/Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | cd src/c; make 3 | 4 | install: 5 | cd src/c; make install 6 | -------------------------------------------------------------------------------- /patches/zookeeper/configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ant compile_jute 3 | cd src/c 4 | ./configure $@ 5 | -------------------------------------------------------------------------------- /scripts/add_line_to_eof.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | for f in `find src \( -name "*.cpp" -or -name "*.hpp" \)`; do 3 | lastline=`tail -n 1 $f` 4 | len=$((${#lastline})) 5 | if [ $len -ne 0 ]; then 6 | echo $f 7 | echo -e "" >> $f 8 | fi 9 | done 10 | -------------------------------------------------------------------------------- /scripts/binary_list.txt: -------------------------------------------------------------------------------- 1 | toolkits/clustering/kmeans 2 | toolkits/graph_analytics/undirected_triangle_count 3 | toolkits/graph_analytics/directed_triangle_count 4 | toolkits/graph_analytics/pagerank 5 | toolkits/graph_analytics/kcore 6 | toolkits/graph_analytics/format_convert 7 | toolkits/graph_analytics/sssp 8 | toolkits/graph_analytics/simple_coloring 9 | toolkits/collaborative_filtering/als 10 | toolkits/collaborative_filtering/sparse_als 11 | toolkits/collaborative_filtering/wals 12 | toolkits/collaborative_filtering/sgd 13 | toolkits/collaborative_filtering/biassgd 14 | toolkits/collaborative_filtering/svdpp 15 | toolkits/collaborative_filtering/svd 16 | toolkits/collaborative_filtering/nmf 17 | toolkits/collaborative_filtering/make_synthetic_als_data 18 | toolkits/graphical_models/loopybp_denoise 19 | toolkits/graphical_models/structured_prediction 20 | toolkits/graphical_models/synthetic_image_data 21 | tookits/topic_modeling/lda_sequential_cgs 22 | tookits/topic_modeling/cgs_lda 23 | tookits/topic_modeling/cgs_lda_mimno_experimental 24 | -------------------------------------------------------------------------------- /scripts/build_osx_static.sh: -------------------------------------------------------------------------------- 1 | if [ ! -d src ]; then 2 | echo "Run from the graphlab root folder" 3 | exit 4 | fi 5 | 6 | 7 | ./configure --no_jvm -D NO_MPI:BOOL=true -D COMPILER_FLAGS="-mmacosx-version-min=10.7" -D MARCH=x86-64 -D MTUNE=generic -D HAS_CRC32:BOOL=false 8 | scripts/compile_static_release.sh 9 | 10 | echo "Packaging binary release..." 11 | 12 | # now package a binary release 13 | # for whatever reason the mac binaries are quite small... 14 | # stripping not necessary 15 | rootdirname="graphlab_mac" 16 | rm -rf ./$rootdirname 17 | mkdir $rootdirname 18 | for file in `cat scripts/binary_list.txt` 19 | do 20 | dname=`dirname $file` 21 | mkdir -p $rootdirname/$dname 22 | cp release/$file $rootdirname/$dname/ 23 | done 24 | 25 | #package all the rest of the stuff 26 | #copy the license 27 | mkdir $rootdirname/license 28 | cp license/LICENSE.txt $rootdirname/license/ 29 | 30 | #copy the README 31 | cp BINARY_README $rootdirname/README 32 | 33 | echo "Binary release packaged in $rootdirname" 34 | tar -cjvf $rootdirname.tar.bz2 $rootdirname 35 | -------------------------------------------------------------------------------- /scripts/compile_static_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ ! -d release ]; then 3 | echo "Run from the graphlab root folder after ./configure" 4 | else 5 | cd release 6 | make external_dependencies 7 | cd .. 8 | rm -f deps/local/lib/libboost*.so deps/local/lib/libhdfs*.so deps/local/lib/libtcmalloc*.so deps/local/lib/libevent*.so deps/local/lib/libproto*.so 9 | rm -f deps/local/lib/libboost*.dylib deps/local/lib/libhdfs*.dylib deps/local/lib/libtcmalloc*.dylib deps/local/lib/libevent*.dylib 10 | cd release 11 | 12 | tmp=$@ 13 | if test $# -lt 1 ; then 14 | tmp=`cat ../scripts/binary_list.txt` 15 | fi 16 | echo $tmp 17 | for file in $tmp 18 | do 19 | pushd . 20 | dname=`dirname $file` 21 | fname=`basename $file` 22 | cd $dname 23 | make -j4 $fname 24 | popd 25 | done 26 | fi 27 | -------------------------------------------------------------------------------- /scripts/ec2/gl-ec2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | cd "`dirname $0`" 20 | PYTHONPATH="./third_party/boto-2.4.1.zip/boto-2.4.1:$PYTHONPATH" python ./gl_ec2.py $@ 21 | -------------------------------------------------------------------------------- /scripts/ec2/third_party/boto-2.4.1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/scripts/ec2/third_party/boto-2.4.1.zip -------------------------------------------------------------------------------- /scripts/ec2_tools/scatter: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | src_path=$(hostname):$1 4 | dest_path=$2 5 | 6 | echo "Copying $src_path to $dest_path" 7 | mpiexec.openmpi -hostfile ~/machines -nolocal -pernode scp -r $src_path $dest_path 8 | 9 | -------------------------------------------------------------------------------- /scripts/ec2_tools/setup-torque: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -e ~/machines ]; then 4 | echo "A list of machines must be provided in ~/machines" 5 | echo "Exiting..." 6 | exit 1 7 | fi 8 | 9 | namenode=$(hostname) 10 | 11 | echo "Install Torque" 12 | mpiexec.openmpi -hostfile ~/machines -pernode \ 13 | sudo apt-get --yes install torque-server torque-scheduler \ 14 | torque-client torque-common torque-mom 15 | 16 | echo "Configuring Server" 17 | sudo bash -c "echo $namenode > /etc/torque/server_name" 18 | sudo cp ~/machines /var/spool/torque/server_priv/nodes 19 | sudo qterm 20 | sudo pbs_server 21 | 22 | echo "Configuring MOM on remote machines" 23 | echo "\$pbsserver $namenode" > /tmp/config_mom 24 | mpiexec.openmpi -hostfile ~/machines -pernode \ 25 | scp $namenode:/tmp/config_mom /tmp/config 26 | mpiexec.openmpi -hostfile ~/machines -pernode \ 27 | sudo cp /tmp/config /var/spool/torque/mom_priv/. 28 | 29 | 30 | mpiexec.openmpi -hostfile ~/machines -pernode sudo momctl -s 31 | mpiexec.openmpi -hostfile ~/machines -pernode sudo pbs_mom 32 | 33 | echo "Configuring queue manager" 34 | sudo qmgr -c 'create queue batch' 35 | sudo qmgr -c 'set queue batch queue_type = Execution' 36 | sudo qmgr -c 'set queue batch resources_default.nodes = 1' 37 | sudo qmgr -c 'set queue batch enabled = True' 38 | sudo qmgr -c 'set queue batch started = True' 39 | sudo qmgr -c 'set server scheduling = True' 40 | sudo qmgr -c 'set server default_queue = batch' 41 | sudo qmgr -c 'set server log_events = 511' 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /scripts/install_graphlab.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git clone https://code.google.com/p/graphlabapi/ 4 | cd graphlab 5 | ./configure | tee install_configure_log.txt 6 | cd release 7 | make -j2 | tee ../v2_debug_log.txt 8 | 9 | -------------------------------------------------------------------------------- /scripts/license_prepend.sh: -------------------------------------------------------------------------------- 1 | DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 2 | echo $DIR 3 | if ! grep -q Apache $1 4 | then 5 | echo $1 6 | cat $DIR/../license/LICENSE_prepend.txt $1 > /tmp/out 7 | mv /tmp/out $1 8 | fi 9 | -------------------------------------------------------------------------------- /scripts/make_all_docs.sh: -------------------------------------------------------------------------------- 1 | doxygen 2 | doxygen Doxyfile_internal 3 | -------------------------------------------------------------------------------- /scripts/make_dist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | major_version=2.1 4 | 5 | echo "THIS MUST BE RUN IN GRAPHLAB HOME" 6 | 7 | ## JOEY: WHY ARE WE REMOVING THE FOLDER AND THEN USING RSYNC? 8 | rm -fR dist/graphlabapi 9 | mkdir -p dist/graphlabapi 10 | rsync -vv -al --delete --delete-excluded \ 11 | --exclude=/debug --exclude=/release --exclude=/profile --exclude=/apps \ 12 | --exclude=.hg --exclude=/matlab \ 13 | --exclude=/dist --exclude=/deps --exclude=*~ --exclude=*.orig --exclude=/configure.deps \ 14 | --exclude /make_dist --exclude /BINARY_README * dist/graphlabapi/. 15 | 16 | mkdir dist/graphlabapi/apps 17 | cp dist/graphlabapi/demoapps/CMakeLists.txt dist/graphlabapi/apps/ 18 | version=`hg summary | grep parent | sed 's/parent: //g' | sed 's/:.*//g'` 19 | version="v${major_version}.$version" 20 | echo "Version: $version" 21 | 22 | 23 | cd dist 24 | tar -vz \ 25 | -cf graphlabapi_${version}.tar.gz \ 26 | graphlabapi 27 | cd .. 28 | 29 | ls -al dist | tail -n 1 30 | 31 | -------------------------------------------------------------------------------- /scripts/mpi_redirect_stdout.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ ! -z "$PMI_RANK" ]; then 4 | RANK=$PMI_RANK 5 | elif [ ! -z "$OMPI_COMM_WORLD_RANK" ]; then 6 | RANK=$OMPI_COMM_WORLD_RANK 7 | else 8 | echo "Unable to figure out MPI Rank!" 9 | exit 1 10 | fi 11 | #echo $RANK 12 | $* 2>&1 | tee out.$RANK 13 | -------------------------------------------------------------------------------- /scripts/mpirsync: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | src_path=$(hostname):$PWD 4 | dest_path=$PWD 5 | mpiexec.openmpi -hostfile ~/machines -nolocal -pernode mkdir -p $dest_path 6 | mpiexec.openmpi -hostfile ~/machines -nolocal -pernode rsync -e 'ssh -o StrictHostKeyChecking=no -i /home/ubuntu/.ssh/id_rsa' -avz --exclude '*.make' --exclude '*.cmake' --exclude '*.internal' --exclude '*.includecache' --exclude '*.o' $src_path/ $dest_path 7 | -------------------------------------------------------------------------------- /scripts/test_dist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #script for auto test graphlab distribution, written by danny bickson 4 | if [ $# -ne 1 ]; then 5 | echo "Usage: $0 " 6 | fi 7 | rm -fR /tmp/graphlabapi* 8 | cp dist/graphlabapi_v1_$1.tar.gz /tmp/ 9 | cd /tmp/ 10 | 11 | tar xvzf graphlabapi_v1_$1.tar.gz 12 | cd /tmp/graphlabapi 13 | ./configure --bootstrap --yes 14 | cd release 15 | make -j8 16 | 17 | cd tests 18 | ./runtests.sh 19 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | subdirs(graphlab) 4 | 5 | -------------------------------------------------------------------------------- /src/graphlab.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_MASTER_INCLUDES 25 | #define GRAPHLAB_MASTER_INCLUDES 26 | 27 | 28 | 29 | 30 | // #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /src/graphlab/aggregation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/graphlab/aggregation/aggregation_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | #include 24 | -------------------------------------------------------------------------------- /src/graphlab/docs/faq.dox: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | \page FAQ FAQ 4 | 5 | ##I am trying to run GraphLab distributed using files from HDFS as input. However, I am getting screens full of errors 6 | 7 | You may need to set the CLASSPATH environment variable. 8 | Instead of running: 9 | 10 | \verbatim 11 | mpiexec -n N ... graphlab_program ... 12 | \endverbatim 13 | 14 | Try running 15 | 16 | \verbatim 17 | mpiexec -n N ... env CLASSPATH=`hadoop classpath` graphlab_program ... 18 | \endverbatim 19 | 20 | ##I am trying to run GraphLab distributed, but it seems to be failing to find my graph input files. I am not using HDFS. 21 | 22 | You need to make sure that all machines have access to the graph files at exactly the same paths. 23 | i.e. Either you need to have an NFS file share, or a distributed file system, or you need to 24 | copy all graph files to all machines. 25 | 26 | 27 | 28 | 29 | */ 30 | -------------------------------------------------------------------------------- /src/graphlab/engine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | # subdirs(callback) 4 | 5 | -------------------------------------------------------------------------------- /src/graphlab/engine/engine_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | 33 | //#include 34 | //#include 35 | //#include 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/graphlab/graph/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | -------------------------------------------------------------------------------- /src/graphlab/graph/graph_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | #ifndef GRAPHLAB_GRAPH_INCLUDES 24 | #define GRAPHLAB_GRAPH_INCLUDES 25 | 26 | #include 27 | #include 28 | #endif 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/graphlab/jni/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | # NOTE: do not link tcmalloc! Does not like Java. 3 | add_jni_library(graphlabjni 4 | org_graphlab_Updater.cpp 5 | org_graphlab_Aggregator.cpp 6 | org_graphlab_Context.cpp 7 | org_graphlab_Core.cpp 8 | java_any.cpp) 9 | 10 | if(JNI_REALLY_FOUND) 11 | # copy to ${SRC}/extapis/java_jni/lib when done 12 | get_target_property(graphlabjni_location graphlabjni LOCATION) 13 | add_custom_command( 14 | TARGET graphlabjni 15 | POST_BUILD 16 | COMMAND cp ${graphlabjni_location} 17 | ${CMAKE_SOURCE_DIR}/extapis/java_jni/lib/ 18 | COMMENT "Copying graphlabjni to extapis/java_jni/lib") 19 | 20 | # if ant is found, build Java classes 21 | if(ANT_FOUND) 22 | add_custom_command( 23 | TARGET graphlabjni 24 | POST_BUILD 25 | COMMAND cd ${CMAKE_SOURCE_DIR}/extapis/java_jni && ant 26 | COMMENT "Building Java classes using Ant.") 27 | else() 28 | message(STATUS 29 | "Ant not detected. Java classes will not be built.") 30 | endif() 31 | 32 | endif() -------------------------------------------------------------------------------- /src/graphlab/jni/org_graphlab_Aggregator.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_graphlab_Aggregator */ 4 | 5 | #ifndef _Included_org_graphlab_Aggregator 6 | #define _Included_org_graphlab_Aggregator 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_graphlab_Aggregator 12 | * Method: initNative 13 | * Signature: ()V 14 | */ 15 | JNIEXPORT void JNICALL Java_org_graphlab_Aggregator_initNative 16 | (JNIEnv *, jclass); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /src/graphlab/jni/org_graphlab_Context.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | /** 24 | * @file org_graphlab_Context.cpp 25 | * Implementations of native methods in \c org.graphlab.Context. Refer to 26 | * corresponding Javadoc. 27 | * @author Jiunn Haur Lim 28 | */ 29 | 30 | #include "org_graphlab_Context.hpp" 31 | #include "org_graphlab_Updater.hpp" 32 | 33 | using namespace graphlab; 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | JNIEXPORT void JNICALL 40 | Java_org_graphlab_Context_schedule 41 | ( JNIEnv *env, 42 | jobject obj, 43 | jlong context_ptr, 44 | jobject updater, 45 | jint vertex_id){ 46 | 47 | // convert longs to pointers 48 | proxy_updater::context *context = (proxy_updater::context *) context_ptr; 49 | context->schedule(vertex_id, proxy_updater(env, updater)); 50 | 51 | } 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif -------------------------------------------------------------------------------- /src/graphlab/jni/org_graphlab_Context.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_graphlab_Context */ 4 | 5 | #ifndef _Included_org_graphlab_Context 6 | #define _Included_org_graphlab_Context 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: org_graphlab_Context 12 | * Method: schedule 13 | * Signature: (JLorg/graphlab/Updater;I)V 14 | */ 15 | JNIEXPORT void JNICALL Java_org_graphlab_Context_schedule 16 | (JNIEnv *, jobject, jlong, jobject, jint); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | #endif 22 | -------------------------------------------------------------------------------- /src/graphlab/jni/org_graphlab_Context.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | /** 24 | * @file org_graphlab_Context.hpp 25 | * \c javah will generate \c org_graphlab_Context.h from the native methods 26 | * defined in \c org.graphlab.Context (and so will overwrite the file every time). 27 | * Define any additional classes/structs/typedefs in this hpp file. 28 | * @author Jiunn Haur Lim 29 | */ 30 | 31 | #ifndef ORG_GRAPHLAB_CONTEXT_HPP 32 | #define ORG_GRAPHLAB_CONTEXT_HPP 33 | 34 | #include 35 | #include "org_graphlab_Context.h" 36 | 37 | // define any additional classes/structs/typedefs here 38 | 39 | #endif -------------------------------------------------------------------------------- /src/graphlab/jni/org_graphlab_Updater.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class org_graphlab_Updater */ 4 | 5 | #ifndef _Included_org_graphlab_Updater 6 | #define _Included_org_graphlab_Updater 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #undef org_graphlab_Updater_IN_EDGES 11 | #define org_graphlab_Updater_IN_EDGES 0L 12 | #undef org_graphlab_Updater_OUT_EDGES 13 | #define org_graphlab_Updater_OUT_EDGES 1L 14 | #undef org_graphlab_Updater_ALL_EDGES 15 | #define org_graphlab_Updater_ALL_EDGES 2L 16 | #undef org_graphlab_Updater_NO_EDGES 17 | #define org_graphlab_Updater_NO_EDGES 3L 18 | #undef org_graphlab_Updater_NULL_CONSISTENCY 19 | #define org_graphlab_Updater_NULL_CONSISTENCY 0L 20 | #undef org_graphlab_Updater_VERTEX_CONSISTENCY 21 | #define org_graphlab_Updater_VERTEX_CONSISTENCY 1L 22 | #undef org_graphlab_Updater_EDGE_CONSISTENCY 23 | #define org_graphlab_Updater_EDGE_CONSISTENCY 2L 24 | #undef org_graphlab_Updater_FULL_CONSISTENCY 25 | #define org_graphlab_Updater_FULL_CONSISTENCY 3L 26 | #undef org_graphlab_Updater_DEFAULT_CONSISTENCY 27 | #define org_graphlab_Updater_DEFAULT_CONSISTENCY 4L 28 | /* 29 | * Class: org_graphlab_Updater 30 | * Method: initNative 31 | * Signature: ()V 32 | */ 33 | JNIEXPORT void JNICALL Java_org_graphlab_Updater_initNative 34 | (JNIEnv *, jclass); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | #endif 40 | -------------------------------------------------------------------------------- /src/graphlab/logger/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | -------------------------------------------------------------------------------- /src/graphlab/logger/backtrace.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_BACKTRACE_HPP 25 | #define GRAPHLAB_BACKTRACE_HPP 26 | 27 | extern void __set_back_trace_file_number(int number); 28 | extern void __print_back_trace(); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/graphlab/logger/fail_method.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_LOGGER_FAIL_METHOD 25 | 26 | #ifdef GRAPHLAB_LOGGER_THROW_ON_FAILURE 27 | #define GRAPHLAB_LOGGER_FAIL_METHOD(str) throw(str) 28 | #else 29 | #define GRAPHLAB_LOGGER_FAIL_METHOD(str) abort() 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/graphlab/logger/logger_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | 25 | #include 26 | #include 27 | 28 | -------------------------------------------------------------------------------- /src/graphlab/macros_undef.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifdef __GNUC__ 25 | #if (GRAPHLAB_MACROS_INC_LEVEL != __INCLUDE_LEVEL__) 26 | #error "A was not paired with a " 27 | #endif 28 | #undef GRAPHLAB_MACROS_INC_LEVEL 29 | #endif 30 | 31 | 32 | #undef GRAPHLAB_MACROS 33 | #undef DISALLOW_COPY_AND_ASSIGN 34 | #undef foreach 35 | #undef rev_foreach 36 | 37 | -------------------------------------------------------------------------------- /src/graphlab/options/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/graphlab/options/graph_help.txt: -------------------------------------------------------------------------------- 1 | "Graph Options\n" 2 | "==============\n" 3 | "ingress: The graph partitioning method to use. May be \"random\"\n" 4 | "\"oblivious\" or \"batch\". The methods are in increasing \n" 5 | "complexity. \"random\" is the simplest and produces the \n" 6 | "worst partitions, while \"batch\" takes the longest, but produces\n" 7 | "a significantly better result.\n" 8 | "\n" 9 | "userecent: An optimization that can decrease memory utilization\n" 10 | "of oblivious and batch significantly at a small\n" 11 | "partitioning penalty. Defaults to 0. Set to 1 to \n" 12 | "enable.\n" 13 | "\n" 14 | "bufsize: The batch size used by the batch ingress method.\n" 15 | "Defaults to 50000. Increasing this number will\n" 16 | "decrease partitioning time with a penalty to partitioning\n" 17 | "quality.\n" 18 | "\n" 19 | -------------------------------------------------------------------------------- /src/graphlab/options/options_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | 25 | /** 26 | * Also contains code that is Copyright 2011 Yahoo! Inc. All rights 27 | * reserved. 28 | * 29 | * Contributed under the iCLA for: 30 | * Joseph Gonzalez (jegonzal@yahoo-inc.com) 31 | * 32 | */ 33 | 34 | 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | -------------------------------------------------------------------------------- /src/graphlab/parallel/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/graphlab/parallel/cache_line_pad.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | /** 24 | * Also contains code that is Copyright 2011 Yahoo! Inc. All rights 25 | * reserved. 26 | * 27 | * Contributed under the iCLA for: 28 | * Joseph Gonzalez (jegonzal@yahoo-inc.com) 29 | * 30 | */ 31 | 32 | 33 | 34 | 35 | 36 | #ifndef GRAPHLAB_CACHE_LINE_PAD 37 | #define GRAPHLAB_CACHE_LINE_PAD 38 | 39 | namespace graphlab { 40 | /** 41 | * Used to prevent false cache sharing by padding T 42 | */ 43 | template struct cache_line_pad { 44 | T value; 45 | char pad[64 - (sizeof(T) % 64)]; 46 | cache_line_pad(const T& value = T()) : value(value) { } 47 | T& operator=(const T& other) { return value = other; } 48 | operator T() const { return value; } 49 | }; // end of cache_line_pad 50 | 51 | }; // end of namespace 52 | 53 | 54 | 55 | 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/graphlab/parallel/parallel_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | 25 | // #include 26 | // #include 27 | 28 | -------------------------------------------------------------------------------- /src/graphlab/rpc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | 4 | -------------------------------------------------------------------------------- /src/graphlab/rpc/dc_init_from_env.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | namespace graphlab { 32 | 33 | bool init_param_from_env(dc_init_param& param) { 34 | char* nodeid = getenv("SPAWNID"); 35 | if (nodeid == NULL) { 36 | return false; 37 | } 38 | param.curmachineid = atoi(nodeid); 39 | 40 | char* nodes = getenv("SPAWNNODES"); 41 | std::string nodesstr = nodes; 42 | if (nodes == NULL) { 43 | return false; 44 | } 45 | 46 | param.machines = strsplit(nodesstr, ","); 47 | for (size_t i = 0;i < param.machines.size(); ++i) { 48 | param.machines[i] = param.machines[i] + ":" + tostr(10000 + i); 49 | } 50 | // set defaults 51 | param.numhandlerthreads = RPC_DEFAULT_NUMHANDLERTHREADS; 52 | param.commtype = RPC_DEFAULT_COMMTYPE; 53 | return true; 54 | } 55 | 56 | } // namespace graphlab 57 | 58 | -------------------------------------------------------------------------------- /src/graphlab/rpc/dc_init_from_env.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_DC_INIT_FROM_ENV_HPP 25 | #define GRAPHLAB_DC_INIT_FROM_ENV_HPP 26 | #include 27 | namespace graphlab { 28 | /** 29 | * \ingroup rpc 30 | * initializes parameters from environment. Returns true on success */ 31 | bool init_param_from_env(dc_init_param& param); 32 | } 33 | 34 | #endif // GRAPHLAB_DC_INIT_FROM_ENV_HPP 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/graphlab/rpc/dc_init_from_mpi.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_DC_INIT_FROM_MPI_HPP 25 | #define GRAPHLAB_DC_INIT_FROM_MPI_HPP 26 | #include 27 | namespace graphlab { 28 | /** 29 | * \ingroup rpc 30 | * initializes parameters from MPI. Returns true on success 31 | MPI must be initialized before calling this function */ 32 | bool init_param_from_mpi(dc_init_param& param, dc_comm_type commtype = TCP_COMM); 33 | } 34 | 35 | #endif // GRAPHLAB_DC_INIT_FROM_MPI_HPP 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/graphlab/rpc/dc_init_from_zookeeper.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_DC_INIT_FROM_ZOOKEEPER_HPP 25 | #define GRAPHLAB_DC_INIT_FROM_ZOOKEEPER_HPP 26 | #include 27 | namespace graphlab { 28 | /** 29 | * \ingroup rpc 30 | * initializes parameters from ZooKeeper. Returns true on success. 31 | * To initialize from Zookeeper, the following environment variables must be set 32 | * 33 | * ZK_SERVERS: A comma separated list of zookeeper servers. Port 34 | * number must be included. 35 | * ZK_JOBNAME: The name of the job to use. This must be unique to the cluster. 36 | * i.e. no other job with the same name must run at the same time 37 | * ZK_NUMNODES: The number of processes to wait for 38 | * 39 | */ 40 | bool init_param_from_zookeeper(dc_init_param& param); 41 | } 42 | 43 | #endif // GRAPHLAB_DC_INIT_FROM_ZOOKEEPER_HPP 44 | 45 | -------------------------------------------------------------------------------- /src/graphlab/rpc/dc_packet_mask.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef DC_PACKET_MASK_HPP 25 | #define DC_PACKET_MASK_HPP 26 | namespace graphlab { 27 | // --------- Packet header types -------------- 28 | 29 | /** 30 | * \internal 31 | * \ingroup rpc 32 | * Used for regular calls which go into a thread pool 33 | * for evaluation 34 | */ 35 | const unsigned char STANDARD_CALL = 1; 36 | 37 | /** 38 | * \internal 39 | \ingroup rpc 40 | * 41 | If control packet flag is set, this packet 42 | does not increment any counters. 43 | */ 44 | const unsigned char CONTROL_PACKET = 16; 45 | 46 | /** 47 | * \internal 48 | * \ingroup rpc 49 | * 50 | * Used to identify that after sending this 51 | * packet, a flush is required 52 | */ 53 | const unsigned char FLUSH_PACKET = 64; 54 | } 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /src/graphlab/rpc/dc_types.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef DISTRIBUTED_CONTROL_TYPES_HPP 25 | #define DISTRIBUTED_CONTROL_TYPES_HPP 26 | #include 27 | #include 28 | namespace graphlab { 29 | /// The type used for numbering processors \ingroup rpc 30 | typedef uint16_t procid_t; 31 | 32 | /** 33 | * \internal 34 | * \ingroup rpc 35 | * The underlying communication protocol 36 | */ 37 | enum dc_comm_type { 38 | TCP_COMM, ///< TCP/IP 39 | SCTP_COMM ///< SCTP (limited support) 40 | }; 41 | 42 | 43 | /** 44 | * \internal 45 | * \ingroup rpc 46 | * A pointer that points directly into 47 | * the middle of a deserialized buffer. 48 | */ 49 | struct wild_pointer { 50 | const void* ptr; 51 | 52 | void load(iarchive& iarc) { 53 | assert(iarc.buf != NULL); 54 | ptr = reinterpret_cast(iarc.buf + iarc.off); 55 | } 56 | }; 57 | }; 58 | #include 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /src/graphlab/rpc/function_arg_types_undef.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #undef __GLRPC_F0 25 | #undef __GLRPC_F1 26 | #undef __GLRPC_F2 27 | #undef __GLRPC_F3 28 | #undef __GLRPC_F4 29 | #undef __GLRPC_F5 30 | #undef __GLRPC_NIF0 31 | #undef __GLRPC_NIF1 32 | #undef __GLRPC_NIF2 33 | #undef __GLRPC_NIF3 34 | #undef __GLRPC_NIF4 35 | #undef __GLRPC_NIF5 36 | #undef __GLRPC_NIF6 37 | #undef __GLRPC_NIF7 38 | #undef __GLRPC_R0 39 | #undef __GLRPC_R1 40 | #undef __GLRPC_R2 41 | #undef __GLRPC_R3 42 | #undef __GLRPC_R4 43 | #undef __GLRPC_R5 44 | #undef __GLRPC_R6 45 | #undef __GLRPC_R7 46 | 47 | #undef __GLRPC_FRESULT 48 | #undef REMOVE_CONST_REF 49 | #undef __GLRPC_FARITY 50 | 51 | -------------------------------------------------------------------------------- /src/graphlab/rpc/get_current_process_hash.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_RPC_GET_CURRENT_PROCESS_HASH_HPP 25 | #define GRAPHLAB_RPC_GET_CURRENT_PROCESS_HASH_HPP 26 | #include 27 | namespace graphlab { 28 | namespace dc_impl { 29 | std::string get_current_process_hash(); 30 | } // dc_impl 31 | } // graphlab 32 | #endif 33 | -------------------------------------------------------------------------------- /src/graphlab/rpc/mem_function_arg_types_undef.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #undef __GLRPC_NIF0 25 | #undef __GLRPC_NIF1 26 | #undef __GLRPC_NIF2 27 | #undef __GLRPC_NIF3 28 | #undef __GLRPC_NIF4 29 | #undef __GLRPC_NIF5 30 | #undef __GLRPC_NIF6 31 | #undef __GLRPC_NIF7 32 | #undef __GLRPC_R0 33 | #undef __GLRPC_R1 34 | #undef __GLRPC_R2 35 | #undef __GLRPC_R3 36 | #undef __GLRPC_R4 37 | #undef __GLRPC_R5 38 | #undef __GLRPC_R6 39 | #undef __GLRPC_R7 40 | 41 | #undef __GLRPC_FRESULT 42 | #undef REMOVE_CONST_REF 43 | #undef __GLRPC_FARITY 44 | 45 | -------------------------------------------------------------------------------- /src/graphlab/rpc/request_reply_handler.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace graphlab { 29 | 30 | void request_reply_handler(distributed_control &dc, procid_t src, 31 | size_t ptr, dc_impl::blob ret) { 32 | dc_impl::ireply_container* a = reinterpret_cast(ptr); 33 | a->receive(src, ret); 34 | } 35 | 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/graphlab/rpc/rpc_includes.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_RPC_INCLUDES 25 | #define GRAPHLAB_RPC_INCLUDES 26 | 27 | #include 28 | #include 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/graphlab/scheduler/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | -------------------------------------------------------------------------------- /src/graphlab/scheduler/scheduler_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | #ifndef GRAPHLAB_SCHEDULER_INCLUDES_HPP 23 | #define GRAPHLAB_SCHEDULER_INCLUDES_HPP 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #endif 34 | -------------------------------------------------------------------------------- /src/graphlab/serialization/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | -------------------------------------------------------------------------------- /src/graphlab/serialization/conditional_serialize.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_SERIALIZATION_CONDITIONAL_SERIALIZE_HPP 25 | #define GRAPHLAB_SERIALIZATION_CONDITIONAL_SERIALIZE_HPP 26 | #include 27 | #include 28 | namespace graphlab { 29 | 30 | template 31 | struct conditional_serialize { 32 | bool hasval; 33 | T val; 34 | 35 | conditional_serialize(): hasval(false) { } 36 | conditional_serialize(T& val): hasval(true), val(val) { } 37 | 38 | conditional_serialize(const conditional_serialize& cs): hasval(cs.hasval), val(cs.val) { } 39 | conditional_serialize& operator=(const conditional_serialize& cs) { 40 | hasval = cs.hasval; 41 | val = cs.val; 42 | return (*this); 43 | } 44 | void save(oarchive& oarc) const { 45 | oarc << hasval; 46 | if (hasval) oarc << val; 47 | } 48 | 49 | void load(iarchive& iarc) { 50 | iarc >> hasval; 51 | if (hasval) iarc >> val; 52 | } 53 | }; 54 | 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /src/graphlab/serialization/serializable_pod.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef SERIALIZABLE_POD_HPP 25 | #define SERIALIZABLE_POD_HPP 26 | 27 | #include 28 | 29 | #define SERIALIZABLE_POD(tname) \ 30 | namespace graphlab { \ 31 | template <> \ 32 | struct gl_is_pod { \ 33 | BOOST_STATIC_CONSTANT(bool, value = true); \ 34 | }; \ 35 | } 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /src/graphlab/serialization/serialization_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | 25 | #include 26 | #include 27 | -------------------------------------------------------------------------------- /src/graphlab/serialization/serialize.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_SERIALIZE_HPP 25 | #define GRAPHLAB_SERIALIZE_HPP 26 | #include 27 | #include 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /src/graphlab/ui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | subdirs(mongoose) 4 | 5 | -------------------------------------------------------------------------------- /src/graphlab/ui/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | GraphLab Dashboard 16 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 31 | 32 | 33 | 34 | 35 | 36 |

GraphLab Visualization Dashboard

37 | 38 | 40 | 41 | 42 |
43 |
44 | 45 |
46 |
47 | 48 |
49 |
50 |
51 |
52 |
53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/graphlab/ui/intel_demo/graph_builder.json: -------------------------------------------------------------------------------- 1 | { "phase_name" : "parsing", 2 | "sys_metrics" : [ 3 | { 4 | "label": "cpu", 5 | "units": "% Utilization", 6 | "id": 1, 7 | "values": [ 8 | ["time", "phase1", "phas2", "phase3"], 9 | [0, 23.4, 0, 17], 10 | [1, 2, 1, 9], 11 | [2, 0, 18, {} ], 12 | [3, 0, 2, {} ], 13 | [4, 0, 0, {}]] 14 | }, 15 | { 16 | "label": "Network", 17 | "units": "MB / Second", 18 | "id": 2, 19 | "values": [ 20 | ["time", "cpu1", "cpu2", "cpu3"], 21 | [0, 23.4, 25, 17], 22 | [1, 24, 18, 9], 23 | [2, 27, 3, 5], 24 | [3, 40, 2, 8], 25 | [4, 75, 12, 2]] 26 | }, 27 | { 28 | "label": "Disk", 29 | "units": "MB / Second", 30 | "id": 3, 31 | "values": [ 32 | ["time", "cpu1", "cpu2", "cpu3"], 33 | [0, 23.4, 25, 17], 34 | [1, 24, 18, 9], 35 | [2, 27, 3, 5], 36 | [3, 40, 2, 8], 37 | [4, 75, 12, 2]] 38 | 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /src/graphlab/ui/intel_demo/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | text-align: center; 3 | } 4 | #instrument_panel { 5 | text-align: center; 6 | } 7 | 8 | .metric_summary { 9 | display: inline-block; 10 | 11 | } 12 | 13 | .metric_summary .name { 14 | display: none; 15 | text-align: center; 16 | } 17 | 18 | .metric_summary .value { 19 | display: none; 20 | text-align: center; 21 | } 22 | 23 | 24 | .aggregate { 25 | display: inline-block; 26 | } 27 | 28 | .aggregate .chart { 29 | width: 400px; 30 | height: 200px; 31 | } 32 | 33 | .aggregate .name { 34 | display: none 35 | } 36 | 37 | 38 | .aggregate .chart { 39 | width: 400px; 40 | height: 200px; 41 | } 42 | 43 | .node { 44 | display: inline-block; 45 | } 46 | 47 | 48 | .node .name { 49 | display: none 50 | } 51 | 52 | 53 | .node .chart { 54 | width: 400px; 55 | height: 200px; 56 | } 57 | 58 | 59 | .graph_builder { 60 | display: inline-block; 61 | } 62 | 63 | .graph_builder .chart { 64 | width: 400px; 65 | height: 200px; 66 | } 67 | 68 | .graph_builder .name { 69 | display: none 70 | } 71 | 72 | 73 | .graph_builder .chart { 74 | width: 400px; 75 | height: 200px; 76 | } 77 | -------------------------------------------------------------------------------- /src/graphlab/ui/mongoose/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | -------------------------------------------------------------------------------- /src/graphlab/ui/mongoose/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2010 Sergey Lyubka 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /src/graphlab/ui/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | text-align: center; 3 | } 4 | #instrument_panel { 5 | text-align: center; 6 | } 7 | 8 | .metric_summary { 9 | display: inline-block; 10 | 11 | } 12 | 13 | .metric_summary .name { 14 | display: none; 15 | text-align: center; 16 | } 17 | 18 | .metric_summary .value { 19 | display: none; 20 | text-align: center; 21 | } 22 | 23 | 24 | .aggregate { 25 | display: inline-block; 26 | } 27 | 28 | .aggregate .chart { 29 | width: 400px; 30 | height: 200px; 31 | } 32 | 33 | .aggregate .name { 34 | display: none 35 | } 36 | 37 | 38 | .aggregate .chart { 39 | width: 400px; 40 | height: 200px; 41 | } 42 | 43 | .node { 44 | display: inline-block; 45 | } 46 | 47 | 48 | .node .name { 49 | display: none 50 | } 51 | 52 | 53 | .node .chart { 54 | width: 400px; 55 | height: 200px; 56 | } 57 | -------------------------------------------------------------------------------- /src/graphlab/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | subdirs(generics) 4 | 5 | -------------------------------------------------------------------------------- /src/graphlab/util/bloom_filter.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef BLOOM_FILTER_HPP 25 | #define BLOOM_FILTER_HPP 26 | #include 27 | 28 | template 29 | class fixed_bloom_filter { 30 | private: 31 | fixed_dense_bitset bits; 32 | public: 33 | inline fixed_bloom_filter() { } 34 | 35 | inline void clear() { 36 | bits.clear(); 37 | } 38 | 39 | inline void insert(uint64_t i) { 40 | for (size_t i = 0;i < probes; ++i) { 41 | bits.set_bit_unsync(i % len); 42 | i = i * 0x9e3779b97f4a7c13LL; 43 | } 44 | } 45 | 46 | inline bool may_contain(size_t i) { 47 | for (size_t i = 0;i < probes; ++i) { 48 | if (bits.get_bit_unsync(i % len) == false) return false; 49 | i = i * 0x9e3779b97f4a7c13LL; 50 | } 51 | return true; 52 | } 53 | 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /src/graphlab/util/branch_hints.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_UTIL_BRANCH_HINTS_HPP 25 | #define GRAPHLAB_UTIL_BRANCH_HINTS_HPP 26 | 27 | #define __likely__(x) __builtin_expect((x),1) 28 | #define __unlikely__(x) __builtin_expect((x),0) 29 | 30 | #endif //GRAPHLAB_UTIL_BRANCH_HINTS_HPP 31 | 32 | -------------------------------------------------------------------------------- /src/graphlab/util/generics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | -------------------------------------------------------------------------------- /src/graphlab/util/generics/float_selector.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_FLOAT_SELECTOR_HPP 25 | #define GRAPHLAB_FLOAT_SELECTOR_HPP 26 | 27 | namespace graphlab { 28 | 29 | template 30 | struct float_selector { 31 | // invalid 32 | }; 33 | 34 | 35 | template <> 36 | struct float_selector<4> { 37 | typedef float float_type; 38 | }; 39 | 40 | template <> 41 | struct float_selector<8> { 42 | typedef double float_type; 43 | }; 44 | 45 | template <> 46 | struct float_selector<16> { 47 | typedef long double float_type; 48 | }; 49 | 50 | } 51 | #endif 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/graphlab/util/generics/integer_selector.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_INTEGER_SELECTOR_HPP 25 | #define GRAPHLAB_INTEGER_SELECTOR_HPP 26 | #include 27 | namespace graphlab { 28 | 29 | template 30 | struct u_integer_selector { 31 | // invalid 32 | }; 33 | 34 | template <> 35 | struct u_integer_selector<1> { 36 | typedef uint8_t integer_type; 37 | }; 38 | 39 | template <> 40 | struct u_integer_selector<2> { 41 | typedef uint16_t integer_type; 42 | }; 43 | 44 | template <> 45 | struct u_integer_selector<4> { 46 | typedef uint32_t integer_type; 47 | }; 48 | 49 | template <> 50 | struct u_integer_selector<8> { 51 | typedef uint64_t integer_type; 52 | }; 53 | 54 | } 55 | #endif 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/graphlab/util/generics/robust_cast.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_ROBUST_CAST_HPP 25 | #define GRAPHLAB_ROBUST_CAST_HPP 26 | 27 | #include 28 | #include 29 | namespace graphlab { 30 | /** robust_cast performs a static cast from type A to type B 31 | if a cast can be done. Return B() otherwise */ 32 | 33 | template 34 | typename boost::disable_if_c::value, 35 | Target>::type 36 | robust_cast(const Source &h) { 37 | return Target(); 38 | } 39 | 40 | template 41 | typename boost::enable_if_c::value, 42 | Target>::type 43 | robust_cast(const Source &h) { 44 | return (Target)h; 45 | } 46 | } 47 | 48 | #endif 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/graphlab/util/generics/vector_zip.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | #ifndef GRAPHLAB_VECTOR_ZIP_HPP 24 | #define GRAPHLAB_VECTOR_ZIP_HPP 25 | 26 | #ifndef __NO_OPENMP__ 27 | #include 28 | #endif 29 | 30 | #include 31 | 32 | namespace graphlab { 33 | template 34 | std::vector > 35 | vector_zip(std::vector& vec1, std::vector& vec2) { 36 | 37 | assert(vec1.size() == vec2.size()); 38 | size_t length = vec1.size(); 39 | 40 | std::vector > out; 41 | out.reserve(length); 42 | out.resize(length); 43 | 44 | #ifdef _OPENMP 45 | #pragma omp parallel for 46 | #endif 47 | for (ssize_t i = 0; i < ssize_t(length); ++i) { 48 | out[i] = (std::pair(vec1[i], vec2[i])); 49 | } 50 | std::vector().swap(vec1); 51 | std::vector().swap(vec2); 52 | return out; 53 | } 54 | } // end of graphlab 55 | #endif 56 | -------------------------------------------------------------------------------- /src/graphlab/util/hash_functions.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_HASH_FUNCTIONS_HPP 25 | #define GRAPHLAB_HASH_FUNCTIONS_HPP 26 | 27 | namespace graphlab { 28 | /** 29 | \ingroup util_internal 30 | A hash function to maps a value to itself 31 | */ 32 | class identity_hash{ 33 | public: 34 | size_t operator()(const size_t &t) const{ 35 | return t; 36 | } 37 | }; 38 | } 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /src/graphlab/util/hdfs.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #include 25 | 26 | namespace graphlab { 27 | 28 | 29 | hdfs& hdfs::get_hdfs() { 30 | static hdfs fs; 31 | return fs; 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /src/graphlab/util/integer_mix.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_INTEGER_MIX_HPP 25 | #define GRAPHLAB_INTEGER_MIX_HPP 26 | #include 27 | namespace graphlab { 28 | // Jenkin's 32 bit integer mix from 29 | // http://burtleburtle.net/bob/hash/integer.html 30 | inline uint32_t integer_mix(uint32_t a) { 31 | a -= (a<<6); 32 | a ^= (a>>17); 33 | a -= (a<<9); 34 | a ^= (a<<4); 35 | a -= (a<<3); 36 | a ^= (a<<10); 37 | a ^= (a>>15); 38 | return a; 39 | } 40 | 41 | } 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /src/graphlab/util/integer_selector.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_INTEGER_SELECTOR_HPP 25 | #define GRAPHLAB_INTEGER_SELECTOR_HPP 26 | #include 27 | namespace graphlab { 28 | 29 | template 30 | struct u_integer_selector { 31 | // invalid 32 | }; 33 | 34 | template <> 35 | struct u_integer_selector<1> { 36 | typedef uint8_t integer_type; 37 | }; 38 | 39 | template <> 40 | struct u_integer_selector<2> { 41 | typedef uint16_t integer_type; 42 | }; 43 | 44 | template <> 45 | struct u_integer_selector<4> { 46 | typedef uint32_t integer_type; 47 | }; 48 | 49 | template <> 50 | struct u_integer_selector<8> { 51 | typedef uint64_t integer_type; 52 | }; 53 | 54 | } 55 | #endif 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/graphlab/util/lock_free_internal.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_UTIL_LOCK_FREE_INTERNAL_HPP 25 | #define GRAPHLAB_UTIL_LOCK_FREE_INTERNAL_HPP 26 | 27 | #include 28 | 29 | namespace graphlab { 30 | namespace lock_free_internal { 31 | 32 | template 33 | union reference_with_counter { 34 | struct { 35 | index_type val; 36 | index_type counter; 37 | } q; 38 | index_type& value() { 39 | return q.val; 40 | } 41 | index_type& counter() { 42 | return q.counter; 43 | } 44 | typename u_integer_selector::integer_type combined; 45 | }; 46 | 47 | } 48 | } 49 | #endif 50 | -------------------------------------------------------------------------------- /src/graphlab/util/mpi_tools.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | 27 | namespace graphlab { 28 | namespace mpi_tools { 29 | void get_master_ranks(std::set& master_ranks) { 30 | uint32_t local_ip = get_local_ip(); 31 | std::vector all_ips; 32 | all_gather(local_ip, all_ips); 33 | std::set visited_ips; 34 | master_ranks.clear(); 35 | for(size_t i = 0; i < all_ips.size(); ++i) { 36 | if(visited_ips.count(all_ips[i]) == 0) { 37 | visited_ips.insert(all_ips[i]); 38 | master_ranks.insert(i); 39 | } 40 | } 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /src/graphlab/util/net_util.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_NET_UTIL_HPP 25 | #define GRAPHLAB_NET_UTIL_HPP 26 | #include 27 | #include 28 | 29 | namespace graphlab { 30 | /** 31 | * \ingroup util 32 | * Returns the first non-localhost ipv4 address 33 | */ 34 | uint32_t get_local_ip(bool print = true); 35 | 36 | /** 37 | * \ingroup util 38 | * Returns the first non-localhost ipv4 address as a standard dot delimited string 39 | */ 40 | std::string get_local_ip_as_str(bool print = true); 41 | /** \ingroup util 42 | * Find a free tcp port and binds it. Caller must release the port. 43 | * Returns a pair of [port, socket handle] 44 | */ 45 | std::pair get_free_tcp_port(); 46 | }; 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /src/graphlab/util/system_usage.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_SYSTEM_USAGE_HPP 25 | #define GRAPHLAB_SYSTEM_USAGE_HPP 26 | 27 | 28 | 29 | 30 | #include 31 | 32 | 33 | namespace graphlab { 34 | 35 | 36 | 37 | 38 | 39 | }; 40 | 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /src/graphlab/util/util_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | // #include 30 | // #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | -------------------------------------------------------------------------------- /src/graphlab/util/web_util.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | #ifndef GRAPHLAB_WEB_UTIL_HPP 24 | #define GRAPHLAB_WEB_UTIL_HPP 25 | 26 | #include 27 | #include 28 | 29 | 30 | namespace graphlab { 31 | namespace web_util { 32 | 33 | /** 34 | * \brief decode a url by converting escape characters 35 | */ 36 | std::string url_decode(const std::string& url); 37 | 38 | /** 39 | * \brief convert a query string into a map 40 | */ 41 | std::map parse_query(const std::string& query); 42 | 43 | } // end of namespace web_util 44 | 45 | }; // end of namespace GraphLab 46 | #endif 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/graphlab/version.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #ifndef GRAPHLAB_VERSION_HPP 25 | #define GRAPHLAB_VERSION_HPP 26 | 27 | #define GRAPHLAB_VERSION "2_1_0" 28 | 29 | #define GRAPHLAB_VERSION_MAJOR 2 30 | #define GRAPHLAB_VERSION_MINOR 1 31 | #define GRAPHLAB_VERSION_REVISION 0 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /src/graphlab/vertex_program/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/graphlab/vertex_program/vertex_program_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/graphlab/warp.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | -------------------------------------------------------------------------------- /tests/data/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(tests) 2 | 3 | copy_files(*) 4 | 5 | -------------------------------------------------------------------------------- /tests/data/test_adj/test.adj: -------------------------------------------------------------------------------- 1 | 0 1 5 2 | 1 2 0 5 3 | 2 2 0 5 4 | 3 2 0 5 5 | -------------------------------------------------------------------------------- /tests/data/test_snap/test.snap: -------------------------------------------------------------------------------- 1 | # Snap Comments 2 | # Blah Blah Blah 3 | 0 5 4 | 1 0 5 | 1 5 6 | 2 0 7 | 2 5 8 | 3 0 9 | 3 5 10 | -------------------------------------------------------------------------------- /tests/data/test_tsv/test.tsv: -------------------------------------------------------------------------------- 1 | 0 5 2 | 1 0 3 | 1 5 4 | 2 0 5 | 2 5 6 | 3 0 7 | 3 5 8 | -------------------------------------------------------------------------------- /tests/dcsc_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | using namespace graphlab; 7 | 8 | int main(int argc, char** argv) { 9 | dcsc_store store; 10 | std::cout << store; 11 | // basic tests 12 | store.insert(1, 2, 1); 13 | store.insert(2, 5, 2); 14 | store.insert(4, 4, 3); 15 | store.insert(4, 5, 4); 16 | store.insert(0, 1, 5); 17 | store.insert(0, 5, 6); 18 | store.insert(0, 3, 7); 19 | store.insert(3, 3, 8); 20 | store.insert(4, 3, 9); 21 | 22 | std::cout << store; 23 | 24 | std::cout << "\n\nPrinting column 0\n"; 25 | typedef dcsc_store::entry_type entry_type; 26 | foreach(const entry_type e, store.get_column(0)) { 27 | std::cout << "(" << e.row() << ", " << e.column() << ") = " << e.value() << "\n"; 28 | } 29 | 30 | std::cout << "\n\nPrinting column 5\n"; 31 | foreach(entry_type e, store.get_column(5)) { 32 | std::cout << "(" << e.row() << ", " << e.column() << ") = " << e.value() << "\n"; 33 | } 34 | 35 | 36 | std::cout << "\n\nChanging column 3 to all 1s\n"; 37 | foreach(entry_type e, store.get_column(3)) { 38 | e.value() = 1; 39 | } 40 | 41 | std::cout << store; 42 | 43 | srand(10); 44 | store.clear(); 45 | std::vector row, col, val; 46 | for (size_t i = 0;i < 10000; ++i) { 47 | row.push_back(rand()); 48 | col.push_back(rand()); 49 | val.push_back(rand()); 50 | } 51 | 52 | store.construct(row.begin(), row.end(), 53 | col.begin(), col.end(), 54 | val.begin(), val.end()); 55 | 56 | for (size_t i = 0;i < 10000; ++i) { 57 | assert(store.find(row[i], col[i]) == val[i]); 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /tests/fiber_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace graphlab; 5 | int numticks = 0; 6 | void threadfn() { 7 | 8 | timer ti; ti.start(); 9 | while(1) { 10 | if (ti.current_time() >= 1) break; 11 | fiber_control::yield(); 12 | __sync_fetch_and_add(&numticks, 1); 13 | } 14 | } 15 | 16 | 17 | void threadfn2() { 18 | 19 | timer ti; ti.start(); 20 | while(1) { 21 | if (ti.current_time() >= 2) break; 22 | fiber_control::yield(); 23 | __sync_fetch_and_add(&numticks, 2); 24 | } 25 | } 26 | 27 | int main(int argc, char** argv) { 28 | timer ti; ti.start(); 29 | fiber_group group; 30 | fiber_group group2; 31 | for (int i = 0;i < 100000; ++i) { 32 | group.launch(threadfn); 33 | group2.launch(threadfn2); 34 | } 35 | group.join(); 36 | std::cout << "Completion in " << ti.current_time() << "s\n"; 37 | std::cout << "Context Switches: " << numticks << "\n"; 38 | group2.join(); 39 | std::cout << "Completion in " << ti.current_time() << "s\n"; 40 | std::cout << "Context Switches: " << numticks << "\n"; 41 | } 42 | -------------------------------------------------------------------------------- /tests/hdfs_test.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | 27 | 28 | #include 29 | 30 | int main(int argc, char **argv) { 31 | { 32 | graphlab::hdfs hdfs; 33 | const bool write = true; 34 | graphlab::hdfs::fstream file(hdfs, "/tmp/joeytest.txt", write); 35 | file.good(); 36 | file << "Hello World\n"; 37 | file.close(); 38 | std::vector files = hdfs.list_files("/tmp/"); 39 | for(size_t i = 0; i < files.size(); ++i) 40 | std::cout << files[i] << std::endl; 41 | } 42 | 43 | { 44 | graphlab::hdfs hdfs; 45 | graphlab::hdfs::fstream file(hdfs, "/tmp/joeytest.txt"); 46 | file.good(); 47 | std::string answer; 48 | std::getline(file, answer); 49 | std::cout << "contents: " << std::endl; 50 | std::cout << answer << std::endl; 51 | file.close(); 52 | } 53 | std::cout << "Done!" << std::endl; 54 | } 55 | -------------------------------------------------------------------------------- /tests/lock_free_pushback.cxx: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * For more about this software visit: 18 | * 19 | * http://www.graphlab.ml.cmu.edu 20 | * 21 | */ 22 | 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | using namespace graphlab; 29 | 30 | std::vector vec; 31 | lockfree_push_back > pusher(vec, 0); 32 | 33 | void testthread(size_t range0, size_t range1) { 34 | for (size_t i = range0;i < range1; ++i) { 35 | pusher.push_back(i); 36 | } 37 | } 38 | 39 | class LockFreePushBack : public CxxTest::TestSuite { 40 | public: 41 | 42 | void test_lockfree_push_back(void) { 43 | thread_group thr; 44 | for (size_t i = 0;i < 16; ++i) { 45 | thr.launch(boost::bind(testthread, i * 100000, (i+1) * 100000)); 46 | } 47 | 48 | thr.join(); 49 | 50 | TS_ASSERT_EQUALS(pusher.size(), (size_t)16 * 100000); 51 | vec.resize(pusher.size()); 52 | std::sort(vec.begin(), vec.end()); 53 | for (size_t i = 0;i < vec.size(); ++i) { 54 | TS_ASSERT_EQUALS(vec[i], i); 55 | } 56 | } 57 | }; 58 | 59 | -------------------------------------------------------------------------------- /tests/sort_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace graphlab; 6 | 7 | int main(int argc, char** argv) { 8 | mpi_tools::init(argc, argv); 9 | distributed_control dc; 10 | std::vector keys; 11 | std::vector values; 12 | for (size_t i = 0;i < 1000000; ++i) { 13 | size_t s = rand(); 14 | keys.push_back(s); values.push_back(s); 15 | } 16 | 17 | sample_sort sorter(dc); 18 | sorter.sort(keys.begin(), keys.end(), 19 | values.begin(), values.end()); 20 | 21 | std::vector > > result(dc.numprocs()); 22 | 23 | std::swap(result[dc.procid()], sorter.result()); 24 | dc.gather(result, 0); 25 | if (dc.procid() == 0) { 26 | // test that it is sorted and the values are correct 27 | size_t last = 0; 28 | for (size_t i = 0;i < result.size(); ++i) { 29 | dc.cout() << result[i].size() << ","; 30 | for (size_t j = 0; j < result[i].size(); ++j) { 31 | ASSERT_EQ(result[i][j].first, result[i][j].second); 32 | ASSERT_GE(result[i][j].first, last); 33 | last = result[i][j].first; 34 | } 35 | } 36 | dc.cout() << std::endl; 37 | } 38 | mpi_tools::finalize(); 39 | } 40 | -------------------------------------------------------------------------------- /toolkits/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | # link_libraries(${Boost_LIBRARIES}) 4 | # link_libraries(${GraphLab_LIBRARIES}) 5 | 6 | 7 | 8 | macro(add_all_subdirectories retval curdir) 9 | file(GLOB sub-dir RELATIVE ${curdir} *) 10 | set(list_of_dirs "") 11 | foreach(dir ${sub-dir}) 12 | if(IS_DIRECTORY ${curdir}/${dir}) 13 | STRING(SUBSTRING ${dir} 0 1 firstchar) 14 | if(${firstchar} STREQUAL "." OR ${firstchar} STREQUAL "_" ) 15 | else(${firstchar} STREQUAL "." OR ${firstchar} STREQUAL "_") 16 | set(list_of_dirs ${list_of_dirs} ${dir}) 17 | message(STATUS "Detected Toolkit: " ${dir}) 18 | add_subdirectory(${dir}) 19 | endif() 20 | endif() 21 | endforeach() 22 | set(${retval} ${list_of_dirs}) 23 | endmacro() 24 | 25 | add_all_subdirectories(retval, ${CMAKE_CURRENT_SOURCE_DIR}) 26 | 27 | -------------------------------------------------------------------------------- /toolkits/clustering/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphProcessing) 2 | 3 | add_graphlab_executable(kmeans kmeans.cpp) 4 | add_graphlab_executable(generate_synthetic generate_synthetic.cpp) 5 | add_graphlab_executable(spectral_clustering spectral_clustering.cpp) 6 | add_graphlab_executable(graph_laplacian_for_sc graph_laplacian_for_sc.cpp) 7 | -------------------------------------------------------------------------------- /toolkits/collaborative_filtering/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | # include(CheckCXXSourceCompiles) 3 | 4 | 5 | 6 | # Build als 7 | add_graphlab_executable(als als.cpp) 8 | requires_eigen(als) # build and attach eigen 9 | 10 | add_graphlab_executable(sparse_als sparse_als.cpp) 11 | requires_eigen(sparse_als) # build and attach eigen 12 | 13 | add_graphlab_executable(wals wals.cpp) 14 | requires_eigen(wals) # build and attach eigen 15 | 16 | add_graphlab_executable(sgd sgd.cpp) 17 | requires_eigen(sgd) # build and attach eigen 18 | 19 | add_graphlab_executable(biassgd biassgd.cpp) 20 | requires_eigen(biassgd) # build and attach eigen 21 | 22 | add_graphlab_executable(svdpp svdpp.cpp) 23 | requires_eigen(svdpp) # build and attach eigen 24 | 25 | add_graphlab_executable(svd svd.cpp) 26 | requires_eigen(svd) # build and attach eigen 27 | 28 | 29 | add_graphlab_executable(nmf nmf.cpp) 30 | requires_eigen(nmf) # build and attach eigen 31 | 32 | add_graphlab_executable(make_synthetic_als_data 33 | make_synthetic_als_data.cpp) 34 | requires_eigen(make_synthetic_als_data) # build and attach eigen 35 | 36 | add_graphlab_executable(adpredictor adpredictor.cpp) 37 | 38 | # add_graphlab_executable(warp_nmf warp_nmf.cpp) 39 | # requires_eigen(warp_sgd) # build and attach eigen 40 | # 41 | # add_graphlab_executable(warp_als_coord warp_als_coord.cpp) 42 | # requires_eigen(warp_als_coord) # build and attach eigen 43 | -------------------------------------------------------------------------------- /toolkits/collaborative_filtering/cdf.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2013 GraphLab Inc. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | */ 18 | #ifndef CDF_HPP 19 | #define CDF_HPP 20 | 21 | #include 22 | 23 | // IMPLEMENTATION OF GAUSSIAN CFD 24 | // TAKEN FROM : http://www.johndcook.com/cpp_phi.html 25 | 26 | // constants 27 | const double phi_a1 = 0.254829592; 28 | const double phi_a2 = -0.284496736; 29 | const double phi_a3 = 1.421413741; 30 | const double phi_a4 = -1.453152027; 31 | const double phi_a5 = 1.061405429; 32 | const double phi_p = 0.3275911; 33 | 34 | 35 | double phi(double x) 36 | { 37 | // Save the sign of x 38 | int sign = 1; 39 | if (x < 0) 40 | sign = -1; 41 | x = fabs(x)/sqrt(2.0); 42 | 43 | // A&S formula 7.1.26 44 | double t = 1.0/(1.0 + phi_p*x); 45 | double y = 1.0 - (((((phi_a5*t + phi_a4)*t) + phi_a3)*t + phi_a2)*t + phi_a1)*t*exp(-x*x); 46 | 47 | return 0.5*(1.0 + sign*y); 48 | } 49 | 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /toolkits/collaborative_filtering/doc.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | // This file contains the documentation for the matrix factorization 21 | // toolkit. 22 | 23 | /** 24 | \defgroup toolkit_matrix_factorization Matrix Factorization 25 | 26 | \section toolkit_matrix_factorization_intro Introduction 27 | 28 | The GraphLab Matrix Factorization toolkit can be used for a wide range 29 | of applications in collaborative filtering and recommendation 30 | systems. Matrix factorization can be cast as a graph processing by 31 | interpreting the typically sparse matrix as a graph and then treating 32 | the vertices as rows and columns. 33 | 34 | In this library we have implemented the following initial algorithms: 35 | 36 | \li Alternating Least Squares \ref als.cpp 37 | \li Positive Singular Value Decomposition \ref svd.cpp 38 | 39 | 40 | \todo Finish documenting the Matrix factorization toolkit description. 41 | 42 | 43 | 44 | 45 | 46 | */ 47 | 48 | -------------------------------------------------------------------------------- /toolkits/collaborative_filtering/stats.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | * Class for collecting graph statistics 19 | */ 20 | 21 | 22 | #ifndef TK_STATS 23 | #define TK_STATS 24 | 25 | 26 | struct stats_info{ 27 | size_t validation_edges; 28 | size_t training_edges; 29 | size_t max_user; 30 | size_t max_item; 31 | 32 | stats_info(){ 33 | validation_edges = training_edges = max_user = max_item = 0; 34 | } 35 | 36 | stats_info & operator+=(const stats_info & other){ 37 | validation_edges += other.validation_edges; 38 | training_edges += other.training_edges; 39 | max_user = std::max(max_user, other.max_user); 40 | max_item = std::max(max_item, other.max_item); 41 | return *this; 42 | } 43 | 44 | /** \brief Save the values to a binary archive */ 45 | void save(graphlab::oarchive& arc) const { arc << validation_edges << training_edges << max_user << max_item; } 46 | 47 | /** \brief Read the values from a binary archive */ 48 | void load(graphlab::iarchive& arc) { arc >> validation_edges >> training_edges >> max_user >> max_item; } 49 | 50 | }; 51 | 52 | 53 | stats_info info; 54 | 55 | 56 | #endif //TK_STATS 57 | -------------------------------------------------------------------------------- /toolkits/collaborative_filtering/types.hpp: -------------------------------------------------------------------------------- 1 | #ifndef TYPES_COMMON 2 | #define TYPES_COMMON 3 | 4 | typedef double real_type; 5 | 6 | /* 7 | * store a matrix is a bipartite graph. One side is the rows and the other is the column. 8 | */ 9 | struct bipartite_graph_descriptor { 10 | int rows, cols; 11 | size_t nonzeros; 12 | bool force_non_square; //do not optimize, so each row and column will get its own graph node, even if the matrix is square 13 | 14 | bipartite_graph_descriptor() : rows(0), cols(0), nonzeros(0), force_non_square(false) { } 15 | 16 | // is the matrix square? 17 | bool is_square() const { return rows == cols && !force_non_square; } 18 | // get the position of the starting row/col node 19 | int get_start_node(bool _rows) const { if (is_square()) return 0; else return (_rows?0:rows); } 20 | // get the position of the ending row/col node 21 | int get_end_node(bool _rows) const { if (is_square()) return rows; else return (_rows?rows:(rows+cols)); } 22 | // get howmany row/column nodes 23 | int num_nodes(bool _rows) const { if (_rows) return rows; else return cols; } 24 | // how many total nodes 25 | int total() const { if (is_square()) return rows; else return rows+cols; } 26 | //is this a row node 27 | bool is_row_node(int id) const { return id < rows; } 28 | //debug print? 29 | bool toprint(int id) const { return (id == 0) || (id == rows - 1) || (id == rows) || (id == rows+cols-1); } 30 | 31 | }; // end of bipartite graph descriptor 32 | 33 | 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /toolkits/computer_vision/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(ComputerVision) 2 | 3 | add_graphlab_executable(grabcut grabcut.cpp) 4 | requires_opencv(grabcut) 5 | 6 | add_graphlab_executable(stitching stitching.cpp) 7 | requires_opencv(stitching) 8 | 9 | add_graphlab_executable(stitching_detailed stitching_detailed.cpp) 10 | requires_opencv(stitching_detailed) 11 | 12 | add_graphlab_executable(stitch stitch_main.cpp) 13 | requires_opencv(stitch) 14 | requires_eigen(stitch) 15 | 16 | add_graphlab_executable(stitch_full stitch_full_main.cpp) 17 | requires_opencv(stitch_full) 18 | requires_eigen(stitch_full) 19 | target_link_libraries( stitch_full ${OpenCV_LIBS} ) 20 | set (CMAKE_C_FLAGS "-g -Wall") 21 | set (CMAKE_CXX_FLAGS "-g -Wall") 22 | 23 | -------------------------------------------------------------------------------- /toolkits/extensions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(Extensions) 2 | 3 | if(CPP11) 4 | 5 | add_library(graphlab_extension STATIC 6 | MurmurHash3.cpp 7 | extension.cpp 8 | extension_graph.cpp 9 | extension_pagerank.cpp) 10 | add_dependencies(graphlab_extension graphlab) 11 | target_link_libraries(graphlab_extension graphlab) 12 | 13 | add_extension_executable(pagerank_extension_driver 14 | pagerank_extension_driver.cpp) 15 | 16 | endif() 17 | -------------------------------------------------------------------------------- /toolkits/extensions/MurmurHash3.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // MurmurHash3 was written by Austin Appleby, and is placed in the public 3 | // domain. The author hereby disclaims copyright to this source code. 4 | 5 | #ifndef _MURMURHASH3_H_ 6 | #define _MURMURHASH3_H_ 7 | 8 | //----------------------------------------------------------------------------- 9 | // Platform-specific functions and macros 10 | 11 | // Microsoft Visual Studio 12 | 13 | #if defined(_MSC_VER) 14 | 15 | typedef unsigned char uint8_t; 16 | typedef unsigned long uint32_t; 17 | typedef unsigned __int64 uint64_t; 18 | 19 | // Other compilers 20 | 21 | #else // defined(_MSC_VER) 22 | 23 | #include 24 | 25 | #endif // !defined(_MSC_VER) 26 | 27 | //----------------------------------------------------------------------------- 28 | 29 | void MurmurHash3_x86_32 ( const void * key, int len, uint32_t seed, void * out ); 30 | 31 | void MurmurHash3_x86_128 ( const void * key, int len, uint32_t seed, void * out ); 32 | 33 | void MurmurHash3_x64_128 ( const void * key, int len, uint32_t seed, void * out ); 34 | 35 | //----------------------------------------------------------------------------- 36 | 37 | #endif // _MURMURHASH3_H_ 38 | -------------------------------------------------------------------------------- /toolkits/extensions/example.txt: -------------------------------------------------------------------------------- 1 | void pagerank(extension_graph& graph) { 2 | graph.transform_field("pr", [](var v){ return 0.15; }); 3 | graph.GAS( 4 | [](const vars&) { return graphlab::IN_EDGES; }, // gather_edges 5 | [](const vars&, vars&, const vars& other, edge_direction) { // gather 6 | return vget(other.field("pr")) / 7 | vget(other.field("out_degree")) ; 8 | }, 9 | [](var& a, const var& b) { // combine 10 | vget(a) += vget(b); 11 | }, 12 | [](vars& v, const var& result) -> bool { // apply 13 | double pr = 0.15 + 0.85 * vget(result); 14 | v.field("change") = 15 | std::fabs(pr - vget(v.field("pr"))) / 16 | vget(v.field("out_degree")); 17 | v.field("pr") = pr; 18 | return false; 19 | }, 20 | [](const vars& v) { // scatter_edges 21 | return vget(v.field("change")) > 0.01 ? 22 | graphlab::OUT_EDGES : graphlab::NO_EDGES; 23 | }, 24 | [](const vars&, const vars&, const vars&, edge_direction) {// scatter 25 | return true; 26 | } 27 | ); // scatter 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /toolkits/extensions/extension.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "extension_gas.hpp" 6 | 7 | namespace graphlab { 8 | namespace extension { 9 | 10 | var& operator+=(var& value, const var& other) { 11 | const double* other_double = boost::get(&other); 12 | const std::string* other_string = boost::get(&other); 13 | const Eigen::VectorXd* other_vector = boost::get(&other); 14 | const Eigen::MatrixXd* other_matrix = boost::get(&other); 15 | 16 | if ( double* val = boost::get( &value) ) { 17 | if (other_double!= NULL) value = (double)(*val) + (*other_double); 18 | else ASSERT_MSG(false, "Type mismatch in operator+="); 19 | } else if ( std::string* val = boost::get( &value) ) { 20 | if (other_string != NULL) (*val) += (*other_string); 21 | else ASSERT_MSG(false, "Type mismatch in operator+="); 22 | } else if ( Eigen::VectorXd* val = boost::get( &value) ) { 23 | if (other_vector!= NULL) (*val) += (*other_vector); 24 | else ASSERT_MSG(false, "Type mismatch in operator+="); 25 | } else if ( Eigen::MatrixXd* val = boost::get( &value) ) { 26 | if (other_matrix!= NULL) (*val) += (*other_matrix); 27 | else ASSERT_MSG(false, "Type mismatch in operator+="); 28 | } 29 | return value; 30 | } 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | // lets get more than we will ever need so it will never need to resize 41 | std::vector descriptor_set(65536); 42 | lockfree_push_back > 43 | descriptor_access(descriptor_set, 0); 44 | 45 | 46 | 47 | var vars::empty_var; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /toolkits/extensions/extension_graph.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "extension_graph.hpp" 3 | 4 | namespace graphlab { 5 | namespace extension { 6 | 7 | 8 | 9 | void extension_graph::synchronous_dispatch_new_engine(size_t desc_id) { 10 | synchronous_engine sync_engine(rmi.dc(), 11 | internal_graph, 12 | __glopts); 13 | sync_engine.signal_all(desc_id); 14 | sync_engine.start(); 15 | } 16 | 17 | 18 | } // extension 19 | } // graphlab 20 | -------------------------------------------------------------------------------- /toolkits/extensions/extension_main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int __real_main(int argc, char** argv); 5 | graphlab::command_line_options __glopts(""); 6 | 7 | 8 | int actual_main(int argc, char** argv) { 9 | graphlab::mpi_tools::init(argc, argv); 10 | if (!__glopts.parse(argc, argv, true)) return false; 11 | // rebuild argc argv with unrecognized options 12 | std::vector vs = __glopts.unrecognized(); 13 | char** newargv = new char*[vs.size() + 1]; 14 | newargv[0] = argv[0]; 15 | for (size_t i = 0;i < vs.size(); ++ i) { 16 | newargv[i + 1] = (char*)(vs[i].c_str()); 17 | } 18 | int ret = __real_main(vs.size() + 1, newargv); 19 | if (graphlab::dc_impl::get_last_dc()) delete graphlab::dc_impl::get_last_dc(); 20 | graphlab::mpi_tools::finalize(); 21 | return ret; 22 | } 23 | 24 | #if 1 25 | // don't seem to be able to get -wrap main working correctly 26 | int main(int argc, char** argv) { 27 | return actual_main(argc, argv); 28 | } 29 | #else 30 | int __wrap_main(int argc, char** argv) { 31 | return actual_main(argc, argv); 32 | } 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /toolkits/extensions/extension_main.hpp: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHLAB_EXTENSION_MAIN_HPP 2 | #define GRAPHLAB_EXTENSION_MAIN_HPP 3 | #include 4 | extern graphlab::command_line_options __glopts; 5 | #endif 6 | -------------------------------------------------------------------------------- /toolkits/extensions/extensions.hpp: -------------------------------------------------------------------------------- 1 | #include "extension_graph.hpp" 2 | 3 | 4 | #ifndef GRAPHLAB_EXTENSIONS_HPP 5 | #define GRAPHLAB_EXTENSIONS_HPP 6 | #if 1 7 | // we have to use this unreliable hack 8 | // don't seem to be able to get -wrap main 9 | // working. TOFIX 10 | #define main __real_main 11 | #endif 12 | 13 | 14 | namespace graphlab { 15 | namespace extension { 16 | 17 | // prototype for all implemented extensions 18 | void pagerank(extension_graph& graph, 19 | const std::string PR_FIELD, 20 | double tolerance); 21 | 22 | } // namespace extension 23 | } // namespace graphlab 24 | 25 | 26 | 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /toolkits/extensions/pagerank_extension_driver.cpp: -------------------------------------------------------------------------------- 1 | #include "extensions.hpp" 2 | #include 3 | using namespace graphlab::extension; 4 | 5 | int main(int argc, char** argv) { 6 | extension_graph graph; 7 | if (argc < 2) { 8 | std::cout << argv[0] << " [input prefix] optional:[output prefix]\n"; 9 | return 0; 10 | } 11 | graph.load_structure(argv[1], "snap"); 12 | pagerank(graph, "pr", 0.01); 13 | if (argc > 2) { 14 | graph.save_vertices(argv[2], "pr"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /toolkits/graph_algorithms/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(Djikstra) 2 | add_graphlab_executable(djikstra djikstra.cpp) 3 | add_graphlab_executable(prestige prestige.cpp) 4 | add_graphlab_executable(betweeness betweeness.cpp) 5 | add_graphlab_executable(closeness closeness.cpp) 6 | -------------------------------------------------------------------------------- /toolkits/graph_analytics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphProcessing) 2 | 3 | add_graphlab_executable(simple_undirected_triangle_count simple_undirected_triangle_count) 4 | add_graphlab_executable(undirected_triangle_count undirected_triangle_count.cpp) 5 | add_graphlab_executable(directed_triangle_count directed_triangle_count.cpp) 6 | add_graphlab_executable(pagerank pagerank.cpp) 7 | add_graphlab_executable(kcore kcore.cpp) 8 | add_graphlab_executable(format_convert format_convert.cpp) 9 | add_graphlab_executable(sssp sssp.cpp) 10 | add_graphlab_executable(simple_coloring simple_coloring.cpp) 11 | add_graphlab_executable(degree_ordered_coloring degree_ordered_coloring.cpp) 12 | add_graphlab_executable(saturation_ordered_coloring saturation_ordered_coloring.cpp) 13 | add_graphlab_executable(connected_component connected_component.cpp) 14 | add_graphlab_executable(connected_component_stats connected_component_stats.cpp) 15 | add_graphlab_executable(approximate_diameter approximate_diameter.cpp) 16 | add_graphlab_executable(eigen_vector_normalization eigen_vector_normalization.cpp) 17 | add_graphlab_executable(graph_laplacian graph_laplacian.cpp) 18 | add_graphlab_executable(partitioning partitioning.cpp) 19 | 20 | # add_graphlab_executable(warp_pagerank warp_pagerank.cpp) 21 | # add_graphlab_executable(warp_pagerank2 warp_pagerank2.cpp) 22 | # add_graphlab_executable(warp_coloring warp_coloring.cpp) 23 | # add_graphlab_executable(warp_bond_percolation warp_bond_percolation.cpp) 24 | # add_graphlab_executable(warp_pagerank_sweeps warp_pagerank_sweeps.cpp) 25 | 26 | add_graphlab_executable(TSC TSC.cpp) 27 | requires_eigen(TSC) 28 | -------------------------------------------------------------------------------- /toolkits/graph_analytics/http/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Twitter Triangle Counter Results 16 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 | 39 |

Twitter Triangle Count Results

40 | 41 | 42 | 43 | 44 |
45 |
46 |
Vertices:
47 |
42 Million
48 |
49 | 50 |
51 |
Edges:
52 |
1.5 Billion
53 |
54 | 55 |
56 |
Triangles:
57 |
188 Billion
58 |
59 |
60 | 61 |
62 | 63 |
64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /toolkits/graph_analytics/http/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | text-align: center; 3 | } 4 | 5 | #main_page { 6 | width: 900px; 7 | margin-left: auto; 8 | margin-right: auto; 9 | 10 | } 11 | 12 | #info { 13 | width: auto; 14 | 15 | } 16 | 17 | .setting { 18 | width: auto; 19 | display: inline-block; 20 | } 21 | 22 | 23 | #results { 24 | 25 | } 26 | 27 | 28 | .user_list { 29 | display: inline-block; 30 | border-style: solid; 31 | height: 600px; 32 | width: 250px; 33 | vertical-align: top; 34 | text-align: left; 35 | margin: 5px; 36 | } 37 | 38 | 39 | 40 | .title { 41 | padding: 10px; 42 | background: black; 43 | color: white; 44 | text-align: center; 45 | } 46 | 47 | 48 | .contents { 49 | padding: 10px; 50 | } 51 | .user_image { 52 | width: 50px; 53 | height: 50px; 54 | } 55 | 56 | .user { 57 | 58 | } 59 | 60 | .user_info { 61 | padding-left: 10px; 62 | display: inline-block; 63 | vertical-align: top; 64 | } 65 | 66 | .name { 67 | 68 | } 69 | 70 | .value { 71 | 72 | 73 | } 74 | 75 | -------------------------------------------------------------------------------- /toolkits/graphical_models/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphicalModels) 2 | 3 | 4 | add_graphlab_executable(dd dd_main.cpp) 5 | requires_eigen(dd) 6 | 7 | add_graphlab_executable(lbp_structured_prediction lbp_structured_prediction.cpp) 8 | requires_eigen(lbp_structured_prediction) 9 | 10 | add_graphlab_executable(profile_lbp_synthetic profile_lbp_synthetic.cpp) 11 | requires_eigen(profile_lbp_synthetic) 12 | 13 | 14 | add_graphlab_executable(profile_lbp_synthetic2 profile_lbp_synthetic2.cpp) 15 | requires_eigen(profile_lbp_synthetic2) 16 | 17 | 18 | add_graphlab_executable(synthetic_image_data synthetic_image_data.cpp) 19 | requires_opencv(synthetic_image_data) 20 | 21 | 22 | 23 | add_graphlab_executable(mplp_denoise mplp_denoise.cpp) 24 | requires_eigen(mplp_denoise) 25 | requires_opencv(mplp_denoise) 26 | 27 | 28 | subdirs(factors) 29 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/factors/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphicalModels) 2 | # add_library(factors STATIC 3 | # binary_factor.cpp 4 | # discrete_variable.cpp 5 | # unary_factor.cpp) -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/factors/binary_factor.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #include 22 | 23 | std::ostream& operator<<(std::ostream& out, 24 | const graphlab::binary_factor& fact) { 25 | out << "Binary Factor(v_" << fact.var1() << " in {1..." 26 | << fact.arity1() << "}, " 27 | << ", v_ " << fact.var2() << " in {1..." 28 | << fact.arity2() << "})" << std::endl; 29 | for(uint16_t i = 0; i < fact.arity1(); ++i) { 30 | for(uint16_t j = 0; j < fact.arity2(); ++j) { 31 | out << fact.logP(i,j) << " "; 32 | } 33 | out << std::endl; 34 | } 35 | return out; 36 | } // end of operator<< 37 | 38 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/factors/discrete_variable.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #include 22 | 23 | std::ostream& operator<<(std::ostream& out, 24 | const graphlab::discrete_variable& var) { 25 | // return out << "v_" << var.id() 26 | // << " in {0:" << var.size()-1 << "}"; 27 | return out << var.id(); 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/factors/factor_includes.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #include "discrete_variable.hpp" 22 | #include "unary_factor.hpp" 23 | #include "binary_factor.hpp" 24 | #include "table_factor.hpp" 25 | 26 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/factors/unary_factor.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #include 22 | 23 | std::ostream& operator<<(std::ostream& out, 24 | const graphlab::unary_factor& fact) { 25 | out << "Unary Factor(" << fact.arity() << ")" 26 | << std::endl; 27 | for(size_t i = 0; i < fact.arity(); ++i) { 28 | out << fact.logP(i) << " "; 29 | } 30 | out << std::endl; 31 | return out; 32 | } // end of operator<< 33 | 34 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | 4 | 5 | 6 | # add_library(pgibbs STATIC 7 | # image.cpp 8 | # chromatic_sampler.cpp 9 | # util.cpp 10 | # factorized_model.cpp 11 | # mrf.cpp 12 | # junction_tree.cpp 13 | # jt_splash_sampler.cpp 14 | # pgibbs_tls.cpp 15 | # global_variables.cpp 16 | # ) 17 | 18 | # add_library(pgibbs_pic STATIC 19 | # image.cpp 20 | # chromatic_sampler.cpp 21 | # util.cpp 22 | # factorized_model.cpp 23 | # mrf.cpp 24 | # junction_tree.cpp 25 | # jt_splash_sampler.cpp 26 | # pgibbs_tls.cpp 27 | # global_variables.cpp 28 | # ) 29 | 30 | # target_link_libraries(pgibbs_pic 31 | # graphlab_pic) 32 | 33 | # target_link_libraries(pgibbs 34 | # graphlab) 35 | 36 | # get_property(pgibbs_flags TARGET pgibbs PROPERTY COMPILE_FLAGS) 37 | # set_target_properties(pgibbs_pic 38 | # PROPERTIES COMPILE_FLAGS "${pgibbs_flags} -fPIC") 39 | 40 | 41 | 42 | 43 | # add_graphlab_executable(make_denoise_alchemy 44 | # make_denoise_alchemy.cpp 45 | # ) 46 | # target_link_libraries(make_denoise_alchemy pgibbs) 47 | 48 | 49 | 50 | 51 | 52 | # add_graphlab_executable(sampler sampler.cpp) 53 | # target_link_libraries(sampler pgibbs) 54 | 55 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/chromatic_sampler.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #ifndef CHROMATIC_SAMPLER_HPP 22 | #define CHROMATIC_SAMPLER_HPP 23 | 24 | #include 25 | 26 | #include "mrf.hpp" 27 | 28 | class gibbs_update : 29 | public graphlab::iupdate_functor { 30 | typedef graphlab::iupdate_functor base; 31 | void operator()(base::icontext_type& context); 32 | }; // end of class gibbs update 33 | 34 | /** Get the update counts for a vertex */ 35 | inline size_t get_nsamples(const mrf_vertex_data& vdata) { 36 | return vdata.nsamples; 37 | } 38 | 39 | 40 | //! Run the chromatic sampler for a fixed ammount of time 41 | void run_chromatic_sampler(graphlab::core& core, 42 | const std::string& chromatic_results_fn, 43 | const std::vector& runtime, 44 | const bool draw_images); 45 | 46 | 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/global_variables.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #include "global_variables.hpp" 22 | 23 | // Global Shared Varaibles ====================================================> 24 | //graphlab::glshared_const SHARED_FACTORS; 25 | const factorized_model::factor_map_t* SHARED_FACTORS_PTR = NULL; 26 | graphlab::glshared_const MAX_NSAMPLES; 27 | graphlab::glshared n_samples; 28 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/global_variables.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #ifndef PGIBBS_GLOBAL_VARIABLES 22 | #define PGIBBS_GLOBAL_VARIABLES 23 | 24 | 25 | #include 26 | 27 | #include "factorized_model.hpp" 28 | 29 | // Global Shared Varaibles ====================================================> 30 | //extern graphlab::glshared_const SHARED_FACTORS; 31 | extern const factorized_model::factor_map_t* SHARED_FACTORS_PTR; 32 | extern graphlab::glshared_const MAX_NSAMPLES; 33 | extern graphlab::glshared n_samples; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/matlab/Makefile: -------------------------------------------------------------------------------- 1 | 2 | gibbs_sampler_impl: gibbs_sampler_impl.cpp matwrap.hpp 3 | mex -largeArrayDims \ 4 | CXXFLAGS="-g -fPIC -Wall -O3 -pthread -fexceptions -fno-omit-frame-pointer -fopenmp" \ 5 | gibbs_sampler_impl.cpp \ 6 | -I../../../src \ 7 | -L../../../release/src/graphlab \ 8 | -L../../../release/src/graphlab/extern/metis/GKlib \ 9 | -L../../../release/src/graphlab/extern/metis/libmetis \ 10 | -L../../../release/demoapps/pgibbs \ 11 | -lpgibbs_pic \ 12 | -lgraphlab_pic \ 13 | -lgomp 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/matlab/asg2ind.m: -------------------------------------------------------------------------------- 1 | function ndx = asg2ind(siz, asg) 2 | multiple = [1, cumprod(siz(1:end-1))]; 3 | assert(isempty(find(asg > siz, 1))); 4 | ndx = sum(multiple .* (asg - 1)) + 1; 5 | end 6 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/matlab/ind2asg.m: -------------------------------------------------------------------------------- 1 | function asg = ind2asg(siz, ndx) 2 | n = length(siz); 3 | asg = zeros(1,n); 4 | ndx = ndx - 1; 5 | for i = 1:n 6 | asg(i) = mod(ndx, siz(i)); 7 | ndx = floor(ndx / siz(i)); 8 | end 9 | asg = asg + 1; 10 | end 11 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/matlab/table_factor.m: -------------------------------------------------------------------------------- 1 | %% Construct a discrete table factor 2 | % 3 | % factor = table_factor(vars, logP) 4 | % 5 | % vars: array of variable ids (e.g., [1,2,4] ) 6 | % logP: tensor representing the log potential values (e.g., ones(3,7,2) 7 | % where variable 1 takes on 3 states variable 2 takes on 7 states and 8 | % variable 4 takes on 2 states. 9 | % 10 | % A table factor represents a factor or potential over a small set of 11 | % discrete variables. Forexample if we wanted to encode a similarity 12 | % funciton over a pair of variables x1 and x2 we could define the table 13 | % factor: 14 | % 15 | % psi(x1,x2) = exp( |x1 - x2| ) 16 | % 17 | % Assuming x1 and x2 take on 4 and 3 values respectively we could define 18 | % the matrix (table) representation of psi: 19 | % 20 | % 0 1 2 21 | % tbl = exp( 1 0 1 ) 22 | % 2 1 0 23 | % 3 2 1 24 | % 25 | % We can build a table factor representing this as: 26 | % 27 | % factor = table_factor([1, 2], tbl); 28 | % 29 | function factor = table_factor(vars, data) 30 | factor.vars = sort(uint32(vars)); 31 | factor.logP = double(data); 32 | end 33 | 34 | %% 35 | % Originally I had hoped to used a matlab class but unfortunatley mex 36 | % support for classes is limited resulting in substantial performance 37 | % penalties when accessing fields. 38 | 39 | % classdef table_factor 40 | % properties (SetAccess = private) 41 | % variables; 42 | % end 43 | % properties 44 | % logP; 45 | % end 46 | % methods 47 | % %% the variables should be a d dimensional array 48 | % function obj = table_factor(vars, data) 49 | % obj.variables = uint32(vars); 50 | % obj.logP = double(data); 51 | % end 52 | % 53 | % end 54 | % 55 | % end 56 | 57 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/matlab/tests/denoise_test.m: -------------------------------------------------------------------------------- 1 | clear; 2 | %% Build the factors 3 | rows = 100; 4 | cols = 100; 5 | states = 5; 6 | lambdaSmooth = 1.5; % Laplace smoothing parameter 7 | noiseP = 0.3; % proportion of randomly sampled values 8 | [factors, img, noisy_img] = ... 9 | make_grid_model(rows, cols, states, lambdaSmooth, noiseP); 10 | 11 | %% 12 | options.alg_type = 'CHROMATIC'; 13 | options.nsamples = 50; 14 | options.nskip = 10; 15 | options.ncpus = 4; 16 | disp('---------------'); 17 | [samples, nupdates, nchanges, marginals] = ... 18 | gibbs_sampler(factors, options); 19 | 20 | %% Take the last set of beliefs and compute the exected value 21 | for i = 1:options.nsamples 22 | % pred_img = reshape(cellfun(@(x) (1:length(x)) * x, marginals(:,i)), ... 23 | % rows, cols); 24 | pred_img = reshape(arrayfun(@(x) (1:length(x)) * x, samples(:,i)), ... 25 | rows, cols); 26 | 27 | figure(1);subplot(1,3,3); colormap('gray'); 28 | imagesc(pred_img); title(['Sample Image ', num2str(i)]); 29 | end 30 | 31 | %% Render the final marginal expectations 32 | 33 | pred_img = reshape(cellfun(@(x) (1:length(x)) * x, marginals(:,i)), ... 34 | rows, cols); 35 | figure(2); colormap('gray'); 36 | imagesc(pred_img); title('Expected Pixel Marginals'); 37 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/pgibbs_tls.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #include "pgibbs_tls.hpp" 22 | 23 | pthread_key_t pgibbs_tls_key; 24 | 25 | pgibbs_tls* create_pgibbs_tls() { 26 | ASSERT_EQ(pthread_getspecific(pgibbs_tls_key), NULL); 27 | pgibbs_tls* data = new pgibbs_tls(); 28 | ASSERT_NE(data, NULL); 29 | pthread_setspecific(pgibbs_tls_key, data); 30 | return data; 31 | } 32 | 33 | pgibbs_tls& get_pgibbs_tls() { 34 | pgibbs_tls* tls = 35 | reinterpret_cast 36 | (pthread_getspecific(pgibbs_tls_key) ); 37 | // If no tsd be has been associated, create one 38 | if(tls == NULL) tls = create_pgibbs_tls(); 39 | ASSERT_NE(tls, NULL); 40 | return *tls; 41 | } 42 | 43 | void destroy_pgibbs_tls(void* ptr) { 44 | pgibbs_tls* tls = 45 | reinterpret_cast(ptr); 46 | if(tls != NULL) delete tls; 47 | 48 | } 49 | 50 | 51 | struct pgibbs_tls_key_creater { 52 | pgibbs_tls_key_creater( ) { 53 | pthread_key_create(&pgibbs_tls_key, 54 | destroy_pgibbs_tls); 55 | } 56 | }; 57 | static const pgibbs_tls_key_creater make_pgibbs_tls_key; 58 | 59 | 60 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/pgibbs_tls.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #ifndef PGIBBS_TLS_HPP 22 | #define PGIBBS_TLS_HPP 23 | 24 | 25 | 26 | /** 27 | * 28 | * This code is used to represent thread local storage needed in some 29 | * of the sampler code 30 | * 31 | * \author Joseph Gonzalez 32 | */ 33 | 34 | // INCLUDES ===================================================================> 35 | 36 | #include 37 | 38 | 39 | #include "factorized_model.hpp" 40 | 41 | 42 | // //! Key used to get the pgibbs tls 43 | // extern pthread_key_t pgibbs_tls_key; 44 | 45 | //! Local state available to each thread 46 | struct pgibbs_tls { 47 | factor_t cavity; 48 | factor_t conditional_factor; 49 | factor_t belief; 50 | factor_t tmp_belief; 51 | }; 52 | 53 | 54 | pgibbs_tls& get_pgibbs_tls(); 55 | 56 | 57 | 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/util.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | 31 | #include "util.hpp" 32 | 33 | 34 | 35 | size_t file_line_count(const std::string& experiment_file) { 36 | std::ifstream fin(experiment_file.c_str()); 37 | size_t lines = 0; 38 | std::string line; 39 | while(getline(fin, line)) lines++; 40 | fin.close(); 41 | return lines; 42 | } 43 | 44 | 45 | std::string make_filename(const std::string& base, 46 | const std::string& suffix, 47 | const size_t number) { 48 | std::stringstream strm; 49 | strm << base 50 | << std::setw(10) << std::setfill('0') 51 | << number 52 | << suffix; 53 | std::cout << strm.str() << std::endl; 54 | return strm.str(); 55 | } 56 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/gibbs_sampling/util.hpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2009 Carnegie Mellon University. 3 | * All rights reserved. 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, 12 | * software distributed under the License is distributed on an "AS 13 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 14 | * express or implied. See the License for the specific language 15 | * governing permissions and limitations under the License. 16 | * 17 | * 18 | */ 19 | 20 | 21 | #ifndef PGIBBS_UTIL_HPP 22 | #define PGIBBS_UTIL_HPP 23 | 24 | #include 25 | 26 | //! Get the number of lines in the file 27 | size_t file_line_count(const std::string& experiment_file); 28 | 29 | 30 | //! make a filename from base sufix and number 31 | std::string make_filename(const std::string& base, 32 | const std::string& suffix, 33 | const size_t number); 34 | 35 | 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/kernelbp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/kernelbp/old/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | # if (ITPP-FOUND) 4 | # add_graphlab_executable(nbp denoise.cpp BallTreeDensity.cpp cpp/BallTreeClass.cc cpp/BallTreeDensityClass.cc) 5 | # endif() 6 | 7 | 8 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/kernelbp/old/cpp/NOTICE: -------------------------------------------------------------------------------- 1 | 2 | The code in this directory, was written by Alex Ihler as a part of Matlab KDE toolbox. 3 | You can obtain the original code from: http://www.ics.uci.edu/~ihler/code/kde.html 4 | 5 | 6 | -------------------------------------------------------------------------------- /toolkits/graphical_models/deprecated/kernelbp/old/fakemex.h: -------------------------------------------------------------------------------- 1 | #ifndef FAKE_MEX 2 | #define FAKE_MEX 3 | /** 4 | * Copyright (c) 2009 Carnegie Mellon University. 5 | * All rights reserved. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an "AS 15 | * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 16 | * express or implied. See the License for the specific language 17 | * governing permissions and limitations under the License. 18 | * 19 | * For more about this software visit: 20 | * 21 | * http://www.graphlab.ml.cmu.edu 22 | * 23 | * Any changes to the code must include this original license notice in full. 24 | * Written by Danny Bickson, CMU 25 | File for defining mex commands in their C implementation */ 26 | 27 | 28 | #include 29 | #include 30 | 31 | #define mxMalloc malloc 32 | #define mxFree free 33 | #define mexErrMsgTxt(a) {printf(a); assert(false); } 34 | #define mxDestroyArray 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /toolkits/graphical_models/factors/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | # add_library(factors STATIC 3 | # binary_factor.cpp 4 | # discrete_variable.cpp 5 | # unary_factor.cpp) 6 | 7 | subdirs(tests) 8 | -------------------------------------------------------------------------------- /toolkits/graphical_models/factors/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | # link_libraries(${Boost_LIBRARIES}) 4 | # link_libraries(${GraphLab_LIBRARIES}) 5 | 6 | 7 | # set include path. doesn't seem like the best way to set this... 8 | include_directories( 9 | ${GraphLab_SOURCE_DIR}/../..) 10 | 11 | 12 | macro(add_all_subdirectories retval curdir) 13 | file(GLOB sub-dir RELATIVE ${curdir} *) 14 | set(list_of_dirs "") 15 | foreach(dir ${sub-dir}) 16 | if(IS_DIRECTORY ${curdir}/${dir}) 17 | STRING(SUBSTRING ${dir} 0 1 firstchar) 18 | if(${firstchar} STREQUAL "." OR ${firstchar} STREQUAL "_" ) 19 | else(${firstchar} STREQUAL "." OR ${firstchar} STREQUAL "_") 20 | set(list_of_dirs ${list_of_dirs} ${dir}) 21 | message(STATUS "Detected App: " ${dir}) 22 | add_subdirectory(${dir}) 23 | endif() 24 | endif() 25 | endforeach() 26 | set(${retval} ${list_of_dirs}) 27 | endmacro() 28 | 29 | add_all_subdirectories(retval, ${CMAKE_CURRENT_SOURCE_DIR}) 30 | 31 | -------------------------------------------------------------------------------- /toolkits/graphical_models/factors/tests/denoise/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | add_graphlab_executable(denoise denoise.cpp) 4 | requires_opencv(denoise) 5 | 6 | file(COPY noisy_img.png 7 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) 8 | file(COPY denoised_gm.png 9 | DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) 10 | 11 | -------------------------------------------------------------------------------- /toolkits/graphical_models/factors/tests/denoise/denoised_gm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/toolkits/graphical_models/factors/tests/denoise/denoised_gm.png -------------------------------------------------------------------------------- /toolkits/graphical_models/factors/tests/denoise/noisy_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/realstolz/powerlyra/cc62c1037c50180ac9d8c7ec5895cd853f3717f8/toolkits/graphical_models/factors/tests/denoise/noisy_img.png -------------------------------------------------------------------------------- /toolkits/graphical_models/factors/tests/test_MAD_relation/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | add_graphlab_executable(test_MAD_relation test_MAD_relation.cpp) 4 | -------------------------------------------------------------------------------- /toolkits/graphical_models/factors/tests/test_bool_var/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | add_graphlab_executable(test_bool_var test_bool_var.cpp) 4 | add_graphlab_executable(test_cat_bool_joint test_cat_bool_joint.cpp) 5 | -------------------------------------------------------------------------------- /toolkits/graphical_models/factors/tests/test_dense_table/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | add_graphlab_executable(test_dense_table test_dense_table.cpp) 4 | -------------------------------------------------------------------------------- /toolkits/graphical_models/factors/tests/test_sparse_table/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | add_graphlab_executable(test_sparse_table test_sparse_table.cpp) 4 | add_graphlab_executable(test_neg_relation test_neg_relation.cpp) 5 | -------------------------------------------------------------------------------- /toolkits/linear_solvers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | # include(CheckCXXSourceCompiles) 3 | 4 | 5 | 6 | # Build als 7 | add_graphlab_executable(jacobi jacobi.cpp) 8 | requires_eigen(jacobi) # build and attach eigen 9 | 10 | 11 | -------------------------------------------------------------------------------- /toolkits/toolkits.dox: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | \page toolkits GraphLab Toolkits 4 | 5 | 6 | To enable users to use GraphLab out-of-the-box and to demonstrate the 7 | power of the GraphLab API we have implemented a collection of 8 | applications to address a wide range of standard tasks in large-scale 9 | graph computation. 10 | 11 | We have implemented the following toolkits 12 | 13 | \li \subpage topic_modeling contains applications like LDA which can be 14 | used to cluster documents and extract topical representations. 15 | 16 | \li \subpage graph_algorithms contains algorithms mostly from the Social Network Analysis Handbook algorithms set. 17 | 18 | \li \subpage graph_analytics contains application like pagerank and 19 | triangle counting which can be applied to general graphs to estimate 20 | community structure. 21 | 22 | \li \subpage clustering contains standard data clustering tools such as 23 | Kmeans 24 | 25 | \li \subpage collaborative_filtering contains a collection of 26 | applications used to make predictions about users interests and 27 | factorize large matrices. 28 | 29 | \li \subpage graphical_models contains tools for making joint predictions 30 | about collections of related random variables. 31 | 32 | \li \subpage factor_graphs contains Belief Propagation impelementation for 33 | factor graphs 34 | 35 | \li \subpage linear_solvers contains solvers for linear systems of equations - currently the Jacobi algorithm is implemented 36 | 37 | \li \subpage computer_vision contains a collection of tools for 38 | reasoning about images. 39 | 40 | 41 | 42 | 43 | 44 | 45 | */ 46 | -------------------------------------------------------------------------------- /toolkits/topic_modeling/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(GraphLab) 2 | 3 | # Primary executable 4 | add_graphlab_executable(lda_sequential_cgs lda_sequential_cgs.cpp) 5 | add_graphlab_executable(cgs_lda cgs_lda.cpp) 6 | add_graphlab_executable(cgs_lda_mimno_experimental cgs_lda_mimno_experimental.cpp) 7 | -------------------------------------------------------------------------------- /toolkits/topic_modeling/http/style.css: -------------------------------------------------------------------------------- 1 | .body { 2 | text-align: center; 3 | 4 | } 5 | .cloud { 6 | display: inline-block; 7 | width: 200px; 8 | height: 200px; 9 | } 10 | 11 | .setting { 12 | display: inline-block; 13 | width: 100px; 14 | } 15 | 16 | .label { 17 | font-size: 14pt; 18 | } 19 | --------------------------------------------------------------------------------