Skip to content

Commit

Permalink
whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
kashif committed Jan 26, 2014
1 parent 6627f67 commit 504490c
Show file tree
Hide file tree
Showing 56 changed files with 954 additions and 954 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CCFILES := $(shell echo src/common/*.cpp)
C_DEPS := $(shell echo include/common/*.h)

include common-gcc-cuda-4.0.mk

makedirectories:
$(VERBOSE)mkdir -p $(LIBDIR)
$(VERBOSE)mkdir -p $(OBJDIR)/src/cudaconv2
Expand Down
8 changes: 4 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/sh

# Fill in these environment variables.
# I have tested this code with CUDA 4.0, 4.1, and 4.2.
# I have tested this code with CUDA 4.0, 4.1, and 4.2.
# Only use Fermi-generation cards. Older cards won't work.

# If you're not sure what these paths should be,
# If you're not sure what these paths should be,
# you can use the find command to try to locate them.
# For example, NUMPY_INCLUDE_PATH contains the file
# arrayobject.h. So you can search for it like this:
#
#
# find /usr -name arrayobject.h
#
#
# (it'll almost certainly be under /usr)

# CUDA toolkit installation directory.
Expand Down
62 changes: 31 additions & 31 deletions common-gcc-cuda-4.0.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#
# Copyright 1993-2010 NVIDIA Corporation. All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property and
# proprietary rights in and to this software and related documentation.
# Any use, reproduction, disclosure, or distribution of this software
# NVIDIA Corporation and its licensors retain all intellectual property and
# proprietary rights in and to this software and related documentation.
# Any use, reproduction, disclosure, or distribution of this software
# and related documentation without an express license agreement from
# NVIDIA Corporation is strictly prohibited.
#
# Please refer to the applicable NVIDIA end user license agreement (EULA)
# associated with this source code for terms and conditions that govern
# Please refer to the applicable NVIDIA end user license agreement (EULA)
# associated with this source code for terms and conditions that govern
# your use of this NVIDIA software.
#
################################################################################
Expand Down Expand Up @@ -45,7 +45,7 @@ OSARCH= $(shell uname -m)

# Basic directory setup for SDK
# (override directories only if they are not already defined)
SRCDIR ?=
SRCDIR ?=
ROOTDIR ?= $(CUDA_SDK_PATH)
ROOTBINDIR ?= bin
BINDIR ?= $(ROOTBINDIR)/$(OSLOWER)
Expand All @@ -55,7 +55,7 @@ COMMONDIR := $(ROOTDIR)/C/common
SHAREDDIR := $(ROOTDIR)/shared/

# Compilers
NVCC := $(CUDA_INSTALL_PATH)/bin/nvcc
NVCC := $(CUDA_INSTALL_PATH)/bin/nvcc
CXX := g++ -fPIC
CC := gcc -fPIC
LINK := g++ -fPIC
Expand Down Expand Up @@ -94,7 +94,7 @@ LIB_ARCH := $(OSARCH)

# Determining the necessary Cross-Compilation Flags
# 32-bit OS, but we target 64-bit cross compilation
ifeq ($(x86_64),1)
ifeq ($(x86_64),1)
NVCCFLAGS += -m64
LIB_ARCH = x86_64
CUDPPLIB_SUFFIX = x86_64
Expand All @@ -103,7 +103,7 @@ ifeq ($(x86_64),1)
else
CXX_ARCH_FLAGS += -m64
endif
else
else
# 64-bit OS, and we target 32-bit cross compilation
ifeq ($(i386),1)
NVCCFLAGS += -m32
Expand All @@ -114,7 +114,7 @@ else
else
CXX_ARCH_FLAGS += -m32
endif
else
else
ifeq "$(strip $(HP_64))" ""
LIB_ARCH = i386
CUDPPLIB_SUFFIX = i386
Expand Down Expand Up @@ -162,10 +162,10 @@ ifeq ($(dbg),1)
CFLAGS += -D_DEBUG
BINSUBDIR := debug
LIBSUFFIX := D
else
COMMONFLAGS += -O2
else
COMMONFLAGS += -O2
BINSUBDIR := release
LIBSUFFIX :=
LIBSUFFIX :=
NVCCFLAGS += --compiler-options -fno-strict-aliasing
CXXFLAGS += -fno-strict-aliasing
CFLAGS += -fno-strict-aliasing
Expand All @@ -187,13 +187,13 @@ CUBIN_ARCH_FLAG :=
# OpenGL is used or not (if it is used, then it is necessary to include GLEW)
ifeq ($(USEGLLIB),1)
ifneq ($(DARWIN),)
OPENGLLIB := -L/System/Library/Frameworks/OpenGL.framework/Libraries
OPENGLLIB := -L/System/Library/Frameworks/OpenGL.framework/Libraries
OPENGLLIB += -lGL -lGLU $(COMMONDIR)/lib/$(OSLOWER)/libGLEW.a
else
# this case for linux platforms
OPENGLLIB := -lGL -lGLU -lX11 -lXi -lXmu
# check if x86_64 flag has been set, otherwise, check HP_64 is i386/x86_64
ifeq ($(x86_64),1)
ifeq ($(x86_64),1)
OPENGLLIB += -lGLEW_x86_64 -L/usr/X11R6/lib64
else
ifeq ($(i386),)
Expand Down Expand Up @@ -224,14 +224,14 @@ ifeq ($(USEGLUT),1)
OPENGLLIB += -framework GLUT
else
ifeq ($(x86_64),1)
OPENGLLIB += -lglut -L/usr/lib64
OPENGLLIB += -lglut -L/usr/lib64
endif
ifeq ($(i386),1)
OPENGLLIB += -lglut -L/usr/lib
OPENGLLIB += -lglut -L/usr/lib
endif

ifeq ($(x86_64),)
ifeq ($(i386),)
ifeq ($(i386),)
OPENGLLIB += -lglut
endif
endif
Expand Down Expand Up @@ -262,11 +262,11 @@ endif

# Libs
ifneq ($(DARWIN),)
LIB += -L$(CUDA_INSTALL_PATH)/lib -L$(LIBDIR) -L$(COMMONDIR)/lib/$(OSLOWER) -L$(SHAREDDIR)/lib $(NVCUVIDLIB)
LIB += -L$(CUDA_INSTALL_PATH)/lib -L$(LIBDIR) -L$(COMMONDIR)/lib/$(OSLOWER) -L$(SHAREDDIR)/lib $(NVCUVIDLIB)
else
ifeq "$(strip $(HP_64))" ""
ifeq ($(x86_64),1)
LIB += -L$(CUDA_INSTALL_PATH)/lib64 -L$(LIBDIR) -L$(COMMONDIR)/lib/$(OSLOWER) -L$(SHAREDDIR)/lib
LIB += -L$(CUDA_INSTALL_PATH)/lib64 -L$(LIBDIR) -L$(COMMONDIR)/lib/$(OSLOWER) -L$(SHAREDDIR)/lib
else
LIB += -L$(CUDA_INSTALL_PATH)/lib -L$(LIBDIR) -L$(COMMONDIR)/lib/$(OSLOWER) -L$(SHAREDDIR)/lib
endif
Expand All @@ -281,15 +281,15 @@ endif

# If dynamically linking to CUDA and CUDART, we exclude the libraries from the LIB
ifeq ($(USECUDADYNLIB),1)
LIB := ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) $(CUDPPLIB) ${LIB} -ldl -rdynamic
LIB := ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) $(CUDPPLIB) ${LIB} -ldl -rdynamic
else
# static linking, we will statically link against CUDA and CUDART
ifeq ($(USEDRVAPI),1)
LIB := -lcuda ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) $(CUDPPLIB) ${LIB}
LIB := -lcuda ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) $(CUDPPLIB) ${LIB}
else
ifeq ($(emu),1)
ifeq ($(emu),1)
LIB += -lcudartemu
else
else
LIB += -lcudart
endif
LIB := ${OPENGLLIB} $(PARAMGLLIB) $(RENDERCHECKGLLIB) $(CUDPPLIB) ${LIB}
Expand Down Expand Up @@ -334,7 +334,7 @@ else
# Device emulation configuration
ifeq ($(emu), 1)
NVCCFLAGS += -deviceemu
CUDACCFLAGS +=
CUDACCFLAGS +=
BINSUBDIR := emu$(BINSUBDIR)
# consistency, makes developing easier
CXXFLAGS += -D__DEVICE_EMULATION__
Expand All @@ -345,7 +345,7 @@ else
LINKLINE = $(LINK) -o $(TARGET) $(OBJS) $(LIB)
endif

# check if verbose
# check if verbose
ifeq ($(verbose), 1)
VERBOSE :=
else
Expand Down Expand Up @@ -381,7 +381,7 @@ CXXFLAGS += $(COMMONFLAGS)
CFLAGS += $(COMMONFLAGS)

ifeq ($(nvcc_warn_verbose),1)
NVCCFLAGS += $(addprefix --compiler-options ,$(CXXWARN_FLAGS))
NVCCFLAGS += $(addprefix --compiler-options ,$(CXXWARN_FLAGS))
NVCCFLAGS += --compiler-options -fno-strict-aliasing
endif

Expand Down Expand Up @@ -429,7 +429,7 @@ $(PTXDIR)/%.ptx : $(SRCDIR)%.cu ptxdirectory
# The following definition is a template that gets instantiated for each SM
# version (sm_10, sm_13, etc.) stored in SMVERSIONS. It does 2 things:
# 1. It adds to OBJS a .cu_sm_XX.o for each .cu file it finds in CUFILES_sm_XX.
# 2. It generates a rule for building .cu_sm_XX.o files from the corresponding
# 2. It generates a rule for building .cu_sm_XX.o files from the corresponding
# .cu file.
#
# The intended use for this is to allow Makefiles that use common.mk to compile
Expand All @@ -455,8 +455,8 @@ $(foreach smver,$(SM_VERSIONS),$(eval $(call SMVERSION_template,$(smver))))

$(TARGET): makedirectories $(OBJS) $(CUBINS) $(PTXBINS) link Makefile
$(VERBOSE)$(LINKLINE)
link:

link:
$(VERBOSE)ln -sf ./bin/linux/release/$(EXECUTABLE) .

cubindirectory:
Expand All @@ -473,7 +473,7 @@ clean : tidy
$(VERBOSE)rm -f *.stub.c *.gpu *.cu.cpp *.i *.ii
$(VERBOSE)rm -f *.cubin *.ptx *.fatbin.c *.hash
$(VERBOSE)rm -f *.cudafe1.c *.cudafe2.c *.cudafe1.cpp *.cudafe2.cpp
$(VERBOSE)rm -f $(OBJS)
$(VERBOSE)rm -f $(OBJS)
$(VERBOSE)rm -f $(CUBINS)
$(VERBOSE)rm -f $(PTXBINS)
$(VERBOSE)rm -f $(TARGET)
Expand Down
26 changes: 13 additions & 13 deletions convdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
Expand Down Expand Up @@ -45,17 +45,17 @@ def get_next_batch(self):
return epoch, batchnum, [datadic['data'], datadic['labels']]

# Returns the dimensionality of the two data matrices returned by get_next_batch
# idx is the index of the matrix.
# idx is the index of the matrix.
def get_data_dims(self, idx=0):
return self.img_size**2 * self.num_colors if idx == 0 else 1

# Takes as input an array returned by get_next_batch
# Returns a (numCases, imgSize, imgSize, 3) array which can be
# fed to pylab for plotting.
# This is used by shownet.py to plot test case predictions.
def get_plottable_data(self, data):
return n.require((data + self.data_mean).T.reshape(data.shape[1], 3, self.img_size, self.img_size).swapaxes(1,3).swapaxes(1,2) / 255.0, dtype=n.single)

class CroppedCIFARDataProvider(LabeledMemoryDataProvider):
def __init__(self, data_dir, batch_range=None, init_epoch=1, init_batchnum=None, dp_params=None, test=False):
LabeledMemoryDataProvider.__init__(self, data_dir, batch_range, init_epoch, init_batchnum, dp_params, test)
Expand All @@ -66,11 +66,11 @@ def __init__(self, data_dir, batch_range=None, init_epoch=1, init_batchnum=None,
self.num_views = 5*2
self.data_mult = self.num_views if self.multiview else 1
self.num_colors = 3

for d in self.data_dic:
d['data'] = n.require(d['data'], requirements='C')
d['labels'] = n.require(n.tile(d['labels'].reshape((1, d['data'].shape[1])), (1, self.data_mult)), requirements='C')

self.cropped_data = [n.zeros((self.get_data_dims(), self.data_dic[0]['data'].shape[1]*self.data_mult), dtype=n.single) for x in xrange(2)]

self.batches_generated = 0
Expand All @@ -85,7 +85,7 @@ def get_next_batch(self):
cropped -= self.data_mean
self.batches_generated += 1
return epoch, batchnum, [cropped, datadic['labels']]

def get_data_dims(self, idx=0):
return self.inner_size**2 * 3 if idx == 0 else 1

Expand All @@ -95,7 +95,7 @@ def get_data_dims(self, idx=0):
# This is used by shownet.py to plot test case predictions.
def get_plottable_data(self, data):
return n.require((data + self.data_mean).T.reshape(data.shape[1], 3, self.inner_size, self.inner_size).swapaxes(1,3).swapaxes(1,2) / 255.0, dtype=n.single)

def __trim_borders(self, x, target):
y = x.reshape(3, 32, 32, x.shape[1])

Expand All @@ -120,19 +120,19 @@ def __trim_borders(self, x, target):
if nr.randint(2) == 0: # also flip the image with 50% probability
pic = pic[:,:,::-1]
target[:,c] = pic.reshape((self.get_data_dims(),))

class DummyConvNetDataProvider(LabeledDummyDataProvider):
def __init__(self, data_dim):
LabeledDummyDataProvider.__init__(self, data_dim)

def get_next_batch(self):
epoch, batchnum, dic = LabeledDummyDataProvider.get_next_batch(self)

dic['data'] = n.require(dic['data'].T, requirements='C')
dic['labels'] = n.require(dic['labels'].T, requirements='C')

return epoch, batchnum, [dic['data'], dic['labels']]

# Returns the dimensionality of the two data matrices returned by get_next_batch
def get_data_dims(self, idx=0):
return self.batch_meta['num_vis'] if idx == 0 else 1
Loading

0 comments on commit 504490c

Please sign in to comment.