Skip to content

Commit 918715c

Browse files
committed
initial commit
0 parents  commit 918715c

174 files changed

Lines changed: 12755 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "caffe-public"]
2+
path = caffe-public
3+
url = https://github.com/yahoo/caffe.git

LICENSE.txt

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
Apache License
2+
Version 2.0, January 2004
3+
4+
http://www.apache.org/licenses/
5+
6+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7+
8+
1. Definitions.
9+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by
10+
Sections 1 through 9 of this document.
11+
12+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting
13+
the License.
14+
15+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are
16+
controlled by, or are under common control with that entity. For the purposes of this definition,
17+
"control" means (i) the power, direct or indirect, to cause the direction or management of such entity,
18+
whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding
19+
shares, or (iii) beneficial ownership of such entity.
20+
21+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
22+
23+
"Source" form shall mean the preferred form for making modifications, including but not limited to software
24+
source code, documentation source, and configuration files.
25+
26+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form,
27+
including but not limited to compiled object code, generated documentation, and conversions to other media types.
28+
29+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License,
30+
as indicated by a copyright notice that is included in or attached to the work (an example is provided in
31+
the Appendix below).
32+
33+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from)
34+
the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent,
35+
as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not
36+
include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work
37+
and Derivative Works thereof.
38+
39+
"Contribution" shall mean any work of authorship, including the original version of the Work and any
40+
modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to
41+
Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to
42+
submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of
43+
electronic, verbal, or written communication sent to the Licensor or its representatives, including but not
44+
limited to communication on electronic mailing lists, source code control systems, and issue tracking systems
45+
that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but
46+
excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner
47+
as "Not a Contribution."
48+
49+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been
50+
received by Licensor and subsequently incorporated within the Work.
51+
52+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby
53+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license
54+
to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute
55+
the Work and such Derivative Works in Source or Object form.
56+
57+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby
58+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated
59+
in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer
60+
the Work, where such license applies only to those patent claims licensable by such Contributor that are
61+
necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work
62+
to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including
63+
a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the
64+
Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under
65+
this License for that Work shall terminate as of the date such litigation is filed.
66+
67+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any
68+
medium, with or without modifications, and in Source or Object form, provided that You meet the following
69+
conditions:
70+
71+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
72+
You must cause any modified files to carry prominent notices stating that You changed the files; and
73+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent,
74+
trademark, and attribution notices from the Source form of the Work, excluding those notices that do not
75+
pertain to any part of the Derivative Works; and
76+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You
77+
distribute must include a readable copy of the attribution notices contained within such NOTICE file,
78+
excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the
79+
following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source
80+
form or documentation, if provided along with the Derivative Works; or, within a display generated by the
81+
Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file
82+
are for informational purposes only and do not modify the License. You may add Your own attribution notices
83+
within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work,
84+
provided that such additional attribution notices cannot be construed as modifying the License.
85+
86+
You may add Your own copyright statement to Your modifications and may provide additional or different
87+
license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such
88+
Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise
89+
complies with the conditions stated in this License.
90+
91+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally
92+
submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this
93+
License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall
94+
supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding
95+
such Contributions.
96+
97+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or
98+
product names of the Licensor, except as required for reasonable and customary use in describing the origin
99+
of the Work and reproducing the content of the NOTICE file.
100+
101+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the
102+
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
103+
OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE,
104+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
105+
determining the appropriateness of using or redistributing the Work and assume any risks associated with Your
106+
exercise of permissions under this License.
107+
108+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence),
109+
contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts)
110+
or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect,
111+
special, incidental, or consequential damages of any character arising as a result of this License or out
112+
of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work
113+
stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such
114+
Contributor has been advised of the possibility of such damages.
115+
116+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof,
117+
You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other
118+
liability obligations and/or rights consistent with this License. However, in accepting such obligations,
119+
You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor,
120+
and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred
121+
by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional
122+
liability.
123+
124+
END OF TERMS AND CONDITIONS

Makefile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
HOME ?=/home/${USER}
2+
CAFFE_ON_SPARK ?=$(shell pwd)
3+
LD_LIBRARY_PATH ?=/home/y/lib64:/home/y/lib64/mkl/intel64
4+
LD_LIBRARY_PATH2=${LD_LIBRARY_PATH}:${CAFFE_ON_SPARK}/caffe-public/distribute/lib:${CAFFE_ON_SPARK}/caffe-distri/distribute/lib:/usr/lib64:/lib64
5+
DYLD_LIBRARY_PATH ?=/home/y/lib64:/home/y/lib64/mkl/intel64
6+
DYLD_LIBRARY_PATH2=${DYLD_LIBRARY_PATH}:${CAFFE_ON_SPARK}/caffe-public/distribute/lib:${CAFFE_ON_SPARK}/caffe-distri/distribute/lib:/usr/lib64:/lib64
7+
8+
build:
9+
cd caffe-public; make proto; make -j4 -e distribute; cd ..
10+
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH2}"; mvn package
11+
jar -xvf caffe-grid/target/caffe-grid-0.1-SNAPSHOT-jar-with-dependencies.jar META-INF/native/linux64/liblmdbjni.so
12+
mv META-INF/native/linux64/liblmdbjni.so ${CAFFE_ON_SPARK}/caffe-distri/distribute/lib
13+
14+
buildosx:
15+
cd caffe-public; make proto; make -j4 -e distribute; cd ..
16+
export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH2}"; mvn package
17+
jar -xvf caffe-grid/target/caffe-grid-0.1-SNAPSHOT-jar-with-dependencies.jar META-INF/native/osx64/liblmdbjni.jnilib
18+
mv META-INF/native/osx64/liblmdbjni.jnilib ${CAFFE_ON_SPARK}/caffe-distri/distribute/lib
19+
20+
update:
21+
git submodule init
22+
git submodule update --force
23+
git submodule foreach --recursive git clean -dfx
24+
25+
doc:
26+
rm -rf scala_doc
27+
scaladoc -cp caffe-grid/target/caffe-grid-0.1-SNAPSHOT-jar-with-dependencies.jar:${HOME}/.m2/repository/org/apache/spark/spark-core_2.10/1.6.0/spark-core_2.10-1.6.0.jar:${HOME}/.m2/repository/org/apache/spark/spark-sql_2.10/1.6.0/spark-sql_2.10-1.6.0.jar:${HOME}/.m2/repository/org/apache/spark/spark-mllib_2.10/1.6.0/spark-mllib_2.10-1.6.0.jar:${HOME}/.m2/repository/org/apache/spark/spark-catalyst_2.10/1.6.0/spark-catalyst_2.10-1.6.0.jar:$(shell hadoop classpath) -d scala_doc caffe-grid/src/main/scala/com/yahoo/ml/caffe/*.scala
28+
29+
gh-pages: doc
30+
git checkout gh-pages
31+
git add -r scala_doc
32+
git commit -m "scala_doc update"
33+
git push origin gh-pages
34+
35+
clean:
36+
pushd caffe-public; make clean; popd
37+
pushd caffe-distri; make clean; popd
38+
mvn clean
39+
40+
ALL: build

README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!--
2+
Copyright 2016 Yahoo Inc.
3+
Licensed under the terms of the Apache 2.0 license.
4+
Please see LICENSE file in the project root for terms.
5+
-->
6+
# CaffeOnSpark
7+
8+
## What's CaffeOnSpark?
9+
10+
CaffeOnSpark brings deep learning to Hadoop and Spark clusters. By
11+
combining salient features from deep learning framework
12+
[Caffe](https://github.com/BVLC/caffe) and big-data frameworks [Apache
13+
Spark](http://spark.apache.org/) and [Apache Hadoop](http://hadoop.apache.org/), CaffeOnSpark enables distributed
14+
deep learning on a cluster of GPU and CPU servers.
15+
16+
As a distributed extension of Caffe, CaffeOnSpark supports neural
17+
network model training, testing, and feature extraction. Caffe users
18+
can now perform distributed learning using their existing LMDB data
19+
files and minorly adjusted network configuration (as
20+
[illustrated](../master/data/lenet_memory_train_test.prototxt#L10-L12)).
21+
22+
CaffeOnSpark is a Spark package for deep learning. It is complementary
23+
to non-deep learning libraries MLlib and Spark SQL.
24+
CaffeOnSpark's Scala API provides Spark applications with an easy
25+
mechanism to invoke deep learning (see
26+
[sample](../master/caffe-grid/src/main/scala/com/yahoo/ml/caffe/examples/MyMLPipeline.scala))
27+
over distributed datasets.
28+
29+
CaffeOnSpark was developed by Yahoo for [large-scale distributed deep
30+
learning on our Hadoop
31+
clusters](http://yahoohadoop.tumblr.com/post/129872361846/large-scale-distributed-deep-learning-on-hadoop)
32+
in Yahoo's private cloud. It's been in use by Yahoo for image search,
33+
content classification and several other use cases.
34+
35+
## Why CaffeOnSpark?
36+
37+
CaffeOnSpark provides some important benefits over alternative deep learning solutions.
38+
39+
* It enables model training, test and feature extraction directly on Hadoop datasets stored in HDFS on Hadoop clusters.
40+
* It turns your Hadoop or Spark cluster(s) into a powerful platform for deep learning, without the need to set up a new dedicated cluster for deep learning separately.
41+
* Server-to-server direct communication (Ethernet or InfiniBand) achieves faster learning and eliminates scalability bottleneck.
42+
* Caffe users' existing datasets (e.g. LMDB) and configurations could be applied for distributed learning without any conversion needed.
43+
* High-level API empowers Spark applications to easily conduct deep learning.
44+
* Incremental learning is supported to leverage previously trained models or snapshots.
45+
* Additional data formats and network interfaces could be easily added.
46+
* It's can be easily deployed on public cloud (ex. AWS EC2) or a private cloud.
47+
48+
## Using CaffeOnSpark
49+
50+
Please check CaffeOnSpark [wiki site](../../wiki) for detailed
51+
documentations including [buiding instruction](../../wiki/build), and
52+
getting started guides for [standalone cluster](../../wiki/GetStarted_local)
53+
and [AWS EC2 cluster](../../wiki/GetStarted_EC2).
54+
55+
Please note:
56+
57+
* Batch sizes specified in prototxt files are per device.
58+
* Memory layers should not be shared among GPUs, and thus "share_in_parallel: false" is required for layer configuration.
59+
60+
## Mailing List
61+
62+
Please join [CaffeOnSpark user
63+
group](https://groups.google.com/forum/#!forum/caffeonspark-users) for
64+
discussions and questions.
65+
66+
67+
## License
68+
69+
The use and distribution terms for this software are covered by the
70+
Apache 2.0 license. See [LICENSE](LICENSE.txt) file for terms.

caffe-distri/.gitignore

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
## General
2+
3+
# Compiled Object files
4+
*.slo
5+
*.lo
6+
*.o
7+
*.cuo
8+
9+
# Compiled Dynamic libraries
10+
*.so
11+
*.dylib
12+
13+
# Compiled Static libraries
14+
*.lai
15+
*.la
16+
*.a
17+
18+
# Compiled protocol buffers
19+
*.pb.h
20+
*.pb.cc
21+
*_pb2.py
22+
23+
# Compiled python
24+
*.pyc
25+
26+
# Compiled MATLAB
27+
*.mex*
28+
29+
# IPython notebook checkpoints
30+
.ipynb_checkpoints
31+
32+
# Editor temporaries
33+
*.swp
34+
*~
35+
36+
# Sublime Text settings
37+
*.sublime-workspace
38+
*.sublime-project
39+
40+
# Eclipse Project settings
41+
*.*project
42+
.settings
43+
44+
# IDEA Project settings
45+
/caffe.iml
46+
47+
# QtCreator files
48+
*.user
49+
50+
# PyCharm files
51+
.idea
52+
53+
# OSX dir files
54+
.DS_Store
55+
56+
## Caffe
57+
58+
src/main/java/caffe/Caffe.java
59+
include/jni/com_yahoo_ml_jcaffe_*.h
60+
.build_release
61+
build
62+
distribute
63+
target

0 commit comments

Comments
 (0)