singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-singa] chrishkchris commented on a change in pull request #468: Distributted module
Date Tue, 06 Aug 2019 13:52:13 GMT
chrishkchris commented on a change in pull request #468: Distributted module
URL: https://github.com/apache/incubator-singa/pull/468#discussion_r311074176
 
 

 ##########
 File path: src/api/config.i
 ##########
 @@ -0,0 +1,33 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+
+
+// Pass in cmake configurations to swig
+#define USE_CUDA 1
+#define USE_CUDNN 1
+#define USE_OPENCL 0
+#define USE_PYTHON 1
+#define USE_MKLDNN 1
+#define USE_JAVA 0
+#define CUDNN_VERSION 7401
+
+// SINGA version
+#define SINGA_MAJOR_VERSION 1
 
 Review comment:
   From the above, we can now train simple CNN (MNIST dataset) and resnet (CIFAR-10 dataset).
The remaining task is the synchronization of the running mean and variance. 
   I tried to put the running mean and var in the batch return list of backward 
   
   ```
       def backward(self, dy):
           assert training is True and hasattr(
               self, "cache"
           ), "Please set training as True before do BP. "
   
           x, scale, mean, var = self.cache
           if isinstance(self.handle, singa.CudnnBatchNormHandle):
               dx, ds, db = singa.GpuBatchNormBackward(
                   self.handle, dy, x, scale, mean, var
               )
           else:
               dx, ds, db = singa.CpuBatchNormBackward(
                   self.handle, dy, x, scale, mean, var
               )
               
           #return dx, ds, db
           return dx, ds, db, self.running_mean, self.running_var
   ```
   and wish to collect it with
   ```
           #all reduce running mean and var
           for p, g in autograd.backward(loss):
               if((p.requires_grad==False) and (p.stores_grad==False)):
                   all_reduce(p)
   ```
   
   However, this is the error in return
   ```
   Traceback (most recent call last):
     File "resnet_multigpu.py", line 163, in <module>
       for p, g in autograd.backward(loss):
     File "/usr/local/lib/python3.5/dist-packages/singa/autograd.py", line 136, in backward
       % (len(op.src), len(dxs))
   AssertionError: the number of src ops (=3) and dx (=5) not match
   ```
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message