Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmake/Thirdparty/FindOpenCL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if(ENV_OPENCLROOT)
OPENCL_INCLUDE_DIR
NAMES CL/cl.h OpenCL/cl.h
PATHS "${ENV_OPENCLROOT}/include"
#NO_DEFAULT_PATH #uncomment this is you wish to surpress the use of default paths for OpenCL
#NO_DEFAULT_PATH #uncomment this is you wish to suppress the use of default paths for OpenCL
)

if (("${CMAKE_SYSTEM_NAME}" MATCHES "Linux") OR ("${CMAKE_SYSTEM_NAME}" MATCHES "Windows"))
Expand All @@ -51,7 +51,7 @@ if(ENV_OPENCLROOT)
OPENCL_LIBRARY
NAMES OpenCL
PATHS "${OPENCL_LIB_SEARCH_PATH}"
#NO_DEFAULT_PATH #uncomment this is you wish to surpress the use of default paths for OpenCL
#NO_DEFAULT_PATH #uncomment this is you wish to suppress the use of default paths for OpenCL
)
else(ENV_OPENCLROOT)
find_path(
Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import sys

# If the user has singa codebase
# will build document from code comments in these loactions
# will build document from code comments in these locations
sys.path.append(os.path.abspath('../python/'))
sys.path.append(os.path.abspath('../build/python/'))

Expand Down
6 changes: 3 additions & 3 deletions doc/device.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ Device
=======


The Device abstract represents any hardware device with memory and compuation units.
The Device abstract represents any hardware device with memory and computation units.
All [Tensor operations](tensor.html) are scheduled by the resident device for execution.
Tensor memory is also managed by the device's memory manager. Therefore, optimization
of memory and execution are implemented in the Device class.

Specific devices
----------------
Currently, SINGA has three Device implmentations,
Currently, SINGA has three Device implementations,

1. CudaGPU for an Nvidia GPU card which runs Cuda code
1. CudaGPU for an NVIDIA GPU card which runs CUDA code
2. CppCPU for a CPU which runs Cpp code
3. OpenclGPU for a GPU card which runs OpenCL code

Expand Down
2 changes: 1 addition & 1 deletion doc/tensor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ allocated on the same device except copy functions.
Tensor implementation
---------------------

SINGA has three different sets of implmentations of Tensor functions, one for each
SINGA has three different sets of implementations of Tensor functions, one for each
type of Device.

* 'tensor_math_cpp.h' implements operations using Cpp (with CBLAS) for CppGPU devices.
Expand Down
10 changes: 5 additions & 5 deletions examples/cifar_distributed_cnn/autograd/mnist_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def reduce_variable(variable, dist_opt, reducer):
return output


# Function to sychronize SINGA TENSOR initial model parameters
# Function to synchronize SINGA TENSOR initial model parameters
def synchronize(tensor, dist_opt):
dist_opt.all_reduce(tensor.data)
dist_opt.wait()
Expand Down Expand Up @@ -176,7 +176,7 @@ def train_mnist_cnn(DIST=False,
batch_size = 64
sgd = opt.SGD(lr=0.005, momentum=0.9, weight_decay=1e-5)

# Prepare training and valadiation data
# Prepare training and validation data
train_x, train_y, test_x, test_y = load_dataset()
IMG_SIZE = 28
num_classes = 10
Expand Down Expand Up @@ -216,7 +216,7 @@ def train_mnist_cnn(DIST=False,
idx = np.arange(train_x.shape[0], dtype=np.int32)

if DIST:
#Sychronize the initial parameters
#Synchronize the initial parameters
autograd.training = True
x = np.random.randn(batch_size, 1, IMG_SIZE,
IMG_SIZE).astype(np.float32)
Expand All @@ -228,7 +228,7 @@ def train_mnist_cnn(DIST=False,
for p, g in autograd.backward(loss):
synchronize(p, sgd)

# Training and evaulation loop
# Training and evaluation loop
for epoch in range(max_epoch):
start_time = time.time()
np.random.shuffle(idx)
Expand Down Expand Up @@ -287,7 +287,7 @@ def train_mnist_cnn(DIST=False,
test_correct += accuracy(tensor.to_numpy(out_test), y)

if DIST:
# Reduce the evaulation accuracy from multiple devices
# Reduce the evaluation accuracy from multiple devices
test_correct = reduce_variable(test_correct, sgd, reducer)

# Output the evaluation accuracy
Expand Down
2 changes: 1 addition & 1 deletion examples/cifar_distributed_cnn/autograd/resnet_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
sgd = opt.DistOpt(sgd)

if (sgd.global_rank == 0):
print("Start intialization...........", flush=True)
print("Start initialization...........", flush=True)

dev = device.create_cuda_gpu_on(sgd.local_rank)

Expand Down
10 changes: 5 additions & 5 deletions examples/cnn/autograd/mnist_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def reduce_variable(variable, dist_opt, reducer):
return output


# Function to sychronize SINGA TENSOR initial model parameters
# Function to synchronize SINGA TENSOR initial model parameters
def synchronize(tensor, dist_opt):
dist_opt.all_reduce(tensor.data)
dist_opt.wait()
Expand Down Expand Up @@ -176,7 +176,7 @@ def train_mnist_cnn(DIST=False,
batch_size = 64
sgd = opt.SGD(lr=0.005, momentum=0.9, weight_decay=1e-5)

# Prepare training and valadiation data
# Prepare training and validation data
train_x, train_y, test_x, test_y = load_dataset()
IMG_SIZE = 28
num_classes = 10
Expand Down Expand Up @@ -216,7 +216,7 @@ def train_mnist_cnn(DIST=False,
idx = np.arange(train_x.shape[0], dtype=np.int32)

if DIST:
#Sychronize the initial parameters
#Synchronize the initial parameters
autograd.training = True
x = np.random.randn(batch_size, 1, IMG_SIZE,
IMG_SIZE).astype(np.float32)
Expand All @@ -228,7 +228,7 @@ def train_mnist_cnn(DIST=False,
for p, g in autograd.backward(loss):
synchronize(p, sgd)

# Training and evaulation loop
# Training and evaluation loop
for epoch in range(max_epoch):
start_time = time.time()
np.random.shuffle(idx)
Expand Down Expand Up @@ -287,7 +287,7 @@ def train_mnist_cnn(DIST=False,
test_correct += accuracy(tensor.to_numpy(out_test), y)

if DIST:
# Reduce the evaulation accuracy from multiple devices
# Reduce the evaluation accuracy from multiple devices
test_correct = reduce_variable(test_correct, sgd, reducer)

# Output the evaluation accuracy
Expand Down
10 changes: 5 additions & 5 deletions examples/cnn/autograd/resnet_cifar10.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def reduce_variable(variable, dist_opt, reducer):
return output


# Function to sychronize SINGA TENSOR initial model parameters
# Function to synchronize SINGA TENSOR initial model parameters
def synchronize(tensor, dist_opt):
dist_opt.all_reduce(tensor.data)
dist_opt.wait()
Expand Down Expand Up @@ -199,7 +199,7 @@ def train_cifar10(DIST=False,
idx = np.arange(train_x.shape[0], dtype=np.int32)

if DIST:
# Sychronize the initial parameters
# Synchronize the initial parameters
autograd.training = True
x = np.random.randn(batch_size, 3, IMG_SIZE,
IMG_SIZE).astype(np.float32)
Expand Down Expand Up @@ -258,11 +258,11 @@ def train_cifar10(DIST=False,
flush=True)

if partial_update:
# Sychronize parameters before evaluation phase
# Synchronize parameters before evaluation phase
for p in param:
synchronize(p, sgd)

# Evaulation phase
# Evaluation phase
autograd.training = False
for b in range(num_test_batch):
x = test_x[b * batch_size:(b + 1) * batch_size]
Expand All @@ -275,7 +275,7 @@ def train_cifar10(DIST=False,
to_categorical(y, num_classes))

if DIST:
# Reduce the evaulation accuracy from multiple devices
# Reduce the evaluation accuracy from multiple devices
test_correct = reduce_variable(test_correct, sgd, reducer)

# Output the evaluation accuracy
Expand Down
2 changes: 1 addition & 1 deletion examples/cnn/autograd/resnet_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
sgd = opt.DistOpt(sgd)

if (sgd.global_rank == 0):
print("Start intialization...........", flush=True)
print("Start initialization...........", flush=True)

dev = device.create_cuda_gpu_on(sgd.local_rank)

Expand Down
2 changes: 1 addition & 1 deletion examples/cnn/autograd/xceptionnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def forward(self, input):

if __name__ == '__main__':
model = Xception(num_classes=1000)
print('Start intialization............')
print('Start initialization............')
dev = device.create_cuda_gpu_on(0)
#dev = device.create_cuda_gpu()

Expand Down
2 changes: 1 addition & 1 deletion examples/cnn/train_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def run(global_rank,
test_correct += accuracy(tensor.to_numpy(out_test), y)

if DIST:
# Reduce the evaulation accuracy from multiple devices
# Reduce the evaluation accuracy from multiple devices
test_correct = reduce_variable(test_correct, sgd, reducer)

# Output the evaluation accuracy
Expand Down
10 changes: 5 additions & 5 deletions examples/cnn_ms/autograd/mnist_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def reduce_variable(variable, dist_opt, reducer):
return output


# Function to sychronize SINGA TENSOR initial model parameters
# Function to synchronize SINGA TENSOR initial model parameters
def synchronize(tensor, dist_opt):
dist_opt.all_reduce(tensor.data)
dist_opt.wait()
Expand Down Expand Up @@ -176,7 +176,7 @@ def train_mnist_cnn(DIST=False,
batch_size = 64
sgd = opt.SGD(lr=0.005, momentum=0.9, weight_decay=1e-5)

# Prepare training and valadiation data
# Prepare training and validation data
train_x, train_y, test_x, test_y = load_dataset()
IMG_SIZE = 28
num_classes = 10
Expand Down Expand Up @@ -216,7 +216,7 @@ def train_mnist_cnn(DIST=False,
idx = np.arange(train_x.shape[0], dtype=np.int32)

if DIST:
#Sychronize the initial parameters
#Synchronize the initial parameters
autograd.training = True
x = np.random.randn(batch_size, 1, IMG_SIZE,
IMG_SIZE).astype(np.float32)
Expand All @@ -228,7 +228,7 @@ def train_mnist_cnn(DIST=False,
for p, g in autograd.backward(loss):
synchronize(p, sgd)

# Training and evaulation loop
# Training and evaluation loop
for epoch in range(max_epoch):
start_time = time.time()
np.random.shuffle(idx)
Expand Down Expand Up @@ -287,7 +287,7 @@ def train_mnist_cnn(DIST=False,
test_correct += accuracy(tensor.to_numpy(out_test), y)

if DIST:
# Reduce the evaulation accuracy from multiple devices
# Reduce the evaluation accuracy from multiple devices
test_correct = reduce_variable(test_correct, sgd, reducer)

# Output the evaluation accuracy
Expand Down
10 changes: 5 additions & 5 deletions examples/cnn_ms/autograd/resnet_cifar10.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def reduce_variable(variable, dist_opt, reducer):
return output


# Function to sychronize SINGA TENSOR initial model parameters
# Function to synchronize SINGA TENSOR initial model parameters
def synchronize(tensor, dist_opt):
dist_opt.all_reduce(tensor.data)
dist_opt.wait()
Expand Down Expand Up @@ -199,7 +199,7 @@ def train_cifar10(DIST=False,
idx = np.arange(train_x.shape[0], dtype=np.int32)

if DIST:
# Sychronize the initial parameters
# Synchronize the initial parameters
autograd.training = True
x = np.random.randn(batch_size, 3, IMG_SIZE,
IMG_SIZE).astype(np.float32)
Expand Down Expand Up @@ -258,11 +258,11 @@ def train_cifar10(DIST=False,
flush=True)

if partial_update:
# Sychronize parameters before evaluation phase
# Synchronize parameters before evaluation phase
for p in param:
synchronize(p, sgd)

# Evaulation phase
# Evaluation phase
autograd.training = False
for b in range(num_test_batch):
x = test_x[b * batch_size:(b + 1) * batch_size]
Expand All @@ -275,7 +275,7 @@ def train_cifar10(DIST=False,
to_categorical(y, num_classes))

if DIST:
# Reduce the evaulation accuracy from multiple devices
# Reduce the evaluation accuracy from multiple devices
test_correct = reduce_variable(test_correct, sgd, reducer)

# Output the evaluation accuracy
Expand Down
2 changes: 1 addition & 1 deletion examples/cnn_ms/autograd/resnet_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
sgd = opt.DistOpt(sgd)

if (sgd.global_rank == 0):
print("Start intialization...........", flush=True)
print("Start initialization...........", flush=True)

dev = device.create_cuda_gpu_on(sgd.local_rank)

Expand Down
2 changes: 1 addition & 1 deletion examples/cnn_ms/autograd/xceptionnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def forward(self, input):

if __name__ == '__main__':
model = Xception(num_classes=1000)
print('Start intialization............')
print('Start initialization............')
dev = device.create_cuda_gpu_on(0)
#dev = device.create_cuda_gpu()

Expand Down
2 changes: 1 addition & 1 deletion examples/cnn_ms/model/alexnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def set_optimizer(self, optimizer):


def create_model(pretrained=False, **kwargs):
"""Constructs a AlexNet model.
"""Constructs an AlexNet model.
Args:
pretrained (bool): If True, returns a pre-trained model.

Expand Down
4 changes: 2 additions & 2 deletions examples/cnn_ms/train_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def run(global_rank,

synflow_flag = False
# Train the model
if epoch == (max_epoch - 1) and b == (num_train_batch - 1): ### synflow calcuation for the last batch
if epoch == (max_epoch - 1) and b == (num_train_batch - 1): ### synflow calculation for the last batch
print ("last epoch calculate synflow")
synflow_flag = True
### step 1: all one input
Expand Down Expand Up @@ -472,7 +472,7 @@ def run(global_rank,
test_correct += accuracy(tensor.to_numpy(out_test), y)

if DIST:
# Reduce the evaulation accuracy from multiple devices
# Reduce the evaluation accuracy from multiple devices
test_correct = reduce_variable(test_correct, mssgd, reducer)

# Output the evaluation accuracy
Expand Down
4 changes: 2 additions & 2 deletions examples/cnn_ms/train_ms_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def run(global_rank,

synflow_flag = False
# Train the model
if epoch == (max_epoch - 1) and b == (num_train_batch - 1): ### synflow calcuation for the last batch
if epoch == (max_epoch - 1) and b == (num_train_batch - 1): ### synflow calculation for the last batch
print ("last epoch calculate synflow")
synflow_flag = True
### step 1: all one input
Expand Down Expand Up @@ -470,7 +470,7 @@ def run(global_rank,
test_correct += accuracy(tensor.to_numpy(out_test), y)

if DIST:
# Reduce the evaulation accuracy from multiple devices
# Reduce the evaluation accuracy from multiple devices
test_correct = reduce_variable(test_correct, mssgd, reducer)

# Output the evaluation accuracy
Expand Down
6 changes: 3 additions & 3 deletions examples/cpp/cifar10/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
specific language governing permissions and limitations
under the License.
-->
# Train CNN over Cifar-10
# Train CNN over CIFAR-10


Convolution neural network (CNN) is a type of feed-forward artificial neural
Expand All @@ -42,7 +42,7 @@ are required. Please refer to the installation page for detailed instructions.

### Data preparation

The binary Cifar-10 dataset could be downloaded by
The binary CIFAR-10 dataset could be downloaded by

python download_data.py bin

Expand All @@ -55,7 +55,7 @@ The Python version could be downloaded by
There are four training programs

1. train.py. The following command would train the VGG model using the python
version of the Cifar-10 dataset in 'cifar-10-batches-py' folder.
version of the CIFAR-10 dataset in 'cifar-10-batches-py' folder.

python train.py vgg cifar-10-batches-py

Expand Down
Loading
Loading