forked from apache/mxnet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#15 from dato-code/build_flexible_type
Pull in SFrame subtree and build flexible_type
- Loading branch information
Showing
2,003 changed files
with
405,782 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,3 +96,4 @@ tags | |
|
||
|
||
miniconda.sh | ||
deps_version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ifndef CXX | ||
CXX = g++ | ||
endif | ||
|
||
SFRAME_SRC = $(PWD)/../plugin/SFrameSubtree/oss_src | ||
DMLC_SRC = $(PWD)/../dmlc-core/include | ||
DEPS = $(PWD)/../deps/local/include | ||
|
||
CFLAGS = -std=c++11 -msse2 -fPIC -O3 -Wall -finline-functions -I$(DEPS) -I$(SFRAME_SRC) -I$(DMLC_SRC) -include $(PWD)/flexible_type.h | ||
|
||
all: flexible_type | ||
|
||
clean: | ||
rm -rf build | ||
|
||
flexible_type: build/libflexible_type.a | ||
|
||
test: build/flexible_type_test | ||
OBJS = $(addprefix build/, flexible_type/flexible_type.o image/image_type.o) | ||
|
||
build/libflexible_type.a: $(OBJS) | ||
ar crv $@ $(filter %.o, $?) | ||
|
||
build/%.o: $(SFRAME_SRC)/%.cpp | ||
@mkdir -p $(@D) | ||
$(CXX) $(CFLAGS) -std=c++0x -MM -MT build/$*.o $< >build/$*.d | ||
$(CXX) $(CFLAGS) -c $< -o $@ | ||
|
||
build/flexible_type_test: test/flexible_type_test.cpp | ||
$(CXX) $(CFLAGS) $< -o $@ -L build -lflexible_type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/*! | ||
* Copyright (c) 2015 by Contributors | ||
* \file flexible_type.h | ||
* \brief | ||
* \author Bing Xu | ||
*/ | ||
#ifndef MXNET_FLEXIBLE_TYPE_H_ | ||
#define MXNET_FLEXIBLE_TYPE_H_ | ||
|
||
#define _ASSERTIONS_H_ | ||
#define GRAPHLAB_LOG_LOG_HPP | ||
|
||
#include <iostream> | ||
#include <dmlc/logging.h> | ||
|
||
// ----------------------- | ||
#define ASSERT_NE CHECK_NE | ||
#define ASSERT_GE CHECK_GE | ||
#define ASSERT_GT CHECK_GT | ||
#define ASSERT_LE CHECK_LE | ||
#define ASSERT_LT CHECK_LT | ||
#define ASSERT_EQ CHECK_EQ | ||
#define ASSERT_MSG(FALSE, MSG, ...) \ | ||
LOG(FATAL) << MSG; | ||
#define ASSERT_FALSE(VAR) \ | ||
CHECK_EQ(VAR, false); | ||
#define DASSERT_FALSE(cond) ASSERT_FALSE(cond) | ||
#define log_and_throw(msg) \ | ||
LOG(FATAL) << msg; | ||
#define logstream(LOGLEVEL) std::cerr | ||
|
||
#include<flexible_type/flexible_type.hpp> | ||
|
||
#endif // MXNET_FLEXIBLE_TYPE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "../flexible_type.h" | ||
#include <image/image_type.hpp> | ||
#include <dmlc/logging.h> | ||
#include <fstream> | ||
|
||
using namespace graphlab; | ||
|
||
void test_int() { | ||
int y = 1; | ||
flexible_type x = y; | ||
CHECK_EQ((int)(x), y); | ||
CHECK_EQ(x.get_type(), flex_type_enum::INTEGER); | ||
} | ||
|
||
void test_float() { | ||
float y = 3.0; | ||
flexible_type x = y; | ||
CHECK_EQ((float)(x), y); | ||
CHECK_EQ(x.get_type(), flex_type_enum::FLOAT); | ||
} | ||
|
||
void test_array() { | ||
std::vector<double> y{1.0, 2.0, 3.0}; | ||
flexible_type x = y; | ||
CHECK_EQ(x.get_type(), flex_type_enum::VECTOR); | ||
CHECK_EQ(x.size(), y.size()); | ||
for (size_t i = 0; i < x.size(); ++i) { | ||
CHECK_EQ(x[i], y[i]); | ||
} | ||
} | ||
|
||
void test_image() { | ||
flex_image x; | ||
CHECK_EQ(x.is_decoded(), false); | ||
CHECK_EQ(x.m_height, 0); | ||
CHECK_EQ(x.m_width, 0); | ||
CHECK_EQ(x.m_channels, 0); | ||
} | ||
|
||
int main() { | ||
test_int(); | ||
test_float(); | ||
test_array(); | ||
test_image(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/*! | ||
* Copyright (c) 2015 by Contributors | ||
* \file flexible_type.h | ||
* \brief | ||
* \author Bing Xu | ||
*/ | ||
#ifndef MXNET_FLEXIBLE_TYPE_H_ | ||
#define MXNET_FLEXIBLE_TYPE_H_ | ||
|
||
#define _ASSERTIONS_H_ | ||
#define GRAPHLAB_LOG_LOG_HPP | ||
// ----------------------- | ||
#define ASSERT_NE CHECK_NE | ||
#define ASSERT_GE CHECK_GE | ||
#define ASSERT_GT CHECK_GT | ||
#define ASSERT_LE CHECK_LE | ||
#define ASSERT_LT CHECK_LT | ||
#define ASSERT_EQ CHECK_EQ | ||
#define ASSERT_MSG(FALSE, MSG, ...) \ | ||
LOG(FATAL) << MSG; | ||
#define ASSERT_FALSE(VAR) \ | ||
CHECK_EQ(VAR, false); | ||
#define DASSERT_FALSE(cond) ASSERT_FALSE(cond) | ||
#define log_and_throw(msg) \ | ||
LOG(FATAL) << msg; | ||
#include<flexible_type/flexible_type.hpp> | ||
|
||
|
||
#endif // MXNET_FLEXIBLE_TYPE_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule mshadow
updated
from 2068a3 to ddfc6d
Oops, something went wrong.