summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-06-24 22:45:18 +0800
committerDeterminant <[email protected]>2015-06-24 22:45:43 +0800
commitb6301089cde20f4c825c7f5deaf179082aad63da (patch)
treeb50b8b476cbf5f0a6bb7d866152dd53eeb91caab
parent32eac093cc431849a92e5a2297c5fe646fd60556 (diff)
use libnervcore & libluaT
-rw-r--r--Makefile4
-rw-r--r--tnet_io/cwrapper.cpp10
-rw-r--r--tnet_io/cwrapper.h2
-rw-r--r--tnet_io/init.c2
4 files changed, 11 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 08c4392..a077df8 100644
--- a/Makefile
+++ b/Makefile
@@ -25,9 +25,9 @@ $(OBJ_DIR) $(LUA_DIR) $(OBJ_SUBDIR) $(LUA_SUBDIR):
$(LUA_DIR)/%.lua: %.lua
cp $< $@
$(LIBS): $(OBJ_DIR)/tnet_io/cwrapper.o $(OBJ_DIR)/init.o $(OBJ_DIR)/tnet_io/init.o $(OBJ_DIR)/tnet_io/libKaldiLib.a
- gcc -shared -o $@ $(OBJ_DIR)/tnet_io/cwrapper.o $(OBJ_DIR)/init.o $(OBJ_DIR)/tnet_io/libKaldiLib.a $(OBJ_DIR)/tnet_io/init.o -lstdc++ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnerv
+ gcc -shared -o $@ $(OBJ_DIR)/tnet_io/cwrapper.o $(OBJ_DIR)/init.o $(OBJ_DIR)/tnet_io/libKaldiLib.a $(OBJ_DIR)/tnet_io/init.o -lstdc++ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnervcore -lluaT
$(OBJ_DIR)/tnet_io/test: $(OBJ_DIR)/tnet_io/cwrapper.o $(OBJ_DIR)/tnet_io/test.o $(OBJ_DIR)/tnet_io/libKaldiLib.a
- gcc -o $@ $^ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnerv -Wl,-rpath=$(LUA_LIBDIR) -L$(LUA_LIBDIR) -lluajit-5.1 -lstdc++ -lm
+ gcc -o $@ $^ -Wl,-rpath=$(LIB_PATH) -L$(LIB_PATH) -lnervcore -Wl,-rpath=$(LUA_LIBDIR) -L$(LUA_LIBDIR) -lluajit-5.1 -lstdc++ -lm
$(OBJ_DIR)/tnet_io/cwrapper.o: tnet_io/cwrapper.cpp
g++ -o $@ -c $< -DHAVE_ATLAS -I tnet_io/KaldiLib/ -g -fPIC $(INCLUDE)
$(OBJ_DIR)/%.o: %.c
diff --git a/tnet_io/cwrapper.cpp b/tnet_io/cwrapper.cpp
index 84e1d63..98ad864 100644
--- a/tnet_io/cwrapper.cpp
+++ b/tnet_io/cwrapper.cpp
@@ -10,7 +10,7 @@ extern "C" {
#include "string.h"
#include "../../nerv/common.h"
- extern Matrix *nerv_matrix_host_float_new_(lua_State *L, long nrow, long ncol);
+ extern Matrix *nerv_matrix_host_float_create(long nrow, long ncol, Status *status);
struct TNetFeatureRepo {
TNet::FeatureRepository feature_repo;
@@ -60,7 +60,9 @@ extern "C" {
repo->feats_host.CheckData(utter_str);
int n = repo->feats_host.Rows();
int m = repo->feats_host.Cols();
- mat = nerv_matrix_host_float_new_(L, n, m);
+ Status status;
+ mat = nerv_matrix_host_float_create(n, m, &status);
+ NERV_LUA_CHECK_STATUS(L, status);
size_t stride = mat->stride;
if (debug)
fprintf(stderr, "[tnet] feature: %s %d %d\n", utter_str.c_str(), n, m);
@@ -124,7 +126,9 @@ extern "C" {
sample_rate, tag);
int n = labs_hosts[0].Rows();
int m = labs_hosts[0].Cols();
- mat = nerv_matrix_host_float_new_(L, n, m);
+ Status status;
+ mat = nerv_matrix_host_float_create(n, m, &status);
+ NERV_LUA_CHECK_STATUS(L, status);
size_t stride = mat->stride;
if (debug)
fprintf(stderr, "[tnet] label: %s %d %d\n", tag, n, m);
diff --git a/tnet_io/cwrapper.h b/tnet_io/cwrapper.h
index 01371ec..a52770b 100644
--- a/tnet_io/cwrapper.h
+++ b/tnet_io/cwrapper.h
@@ -1,6 +1,6 @@
#ifndef NERV_TNET_IO_CWRAPPER
#define NERV_TNET_IO_CWRAPPER
-#include "../../nerv/matrix/generic/matrix.h"
+#include "../../nerv/lib/matrix/matrix.h"
#include "../../nerv/common.h"
#ifdef __cplusplus
extern "C" {
diff --git a/tnet_io/init.c b/tnet_io/init.c
index 5251d1e..3e3f90d 100644
--- a/tnet_io/init.c
+++ b/tnet_io/init.c
@@ -4,7 +4,7 @@
const char *nerv_tnet_feat_repo_tname = "nerv.TNetFeatureRepo";
const char *nerv_tnet_label_repo_tname = "nerv.TNetLabelRepo";
-extern const char *nerv_matrix_host_float_tname;
+const char *nerv_matrix_host_float_tname = "nerv.MMatrixFloat";
static int feat_repo_new(lua_State *L) {
const char *scp_file = luaL_checkstring(L, 1);