lanking520 commented on a change in pull request #11477: Copy profiler examples 
to new location for CI
URL: https://github.com/apache/incubator-mxnet/pull/11477#discussion_r199022352
 
 

 ##########
 File path: 
scala-package/examples/src/main/scala/org/apache/mxnet/examples/profiler/ProfilerMatMul.scala
 ##########
 @@ -0,0 +1,107 @@
+/*
+ * 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.
+ */
+
+package org.apache.mxnet.examples.profiler
+
+import org.kohsuke.args4j.{CmdLineParser, Option}
+import org.slf4j.LoggerFactory
+import scala.collection.JavaConverters._
+import org.apache.mxnet.Context
+import org.apache.mxnet.Profiler
+import java.io.File
+import org.apache.mxnet.Symbol
+import org.apache.mxnet.Shape
+import org.apache.mxnet.Random
+
+/**
+ * @author Depeng Liang
+ */
+object ProfilerMatMul {
+  private val logger = LoggerFactory.getLogger(classOf[ProfilerMatMul])
+
+  def main(args: Array[String]): Unit = {
+    val erul = new ProfilerMatMul
+    val parser: CmdLineParser = new CmdLineParser(erul)
+    try {
+      parser.parseArgument(args.toList.asJava)
+      val ctx = if (erul.gpu >= 0) Context.gpu(erul.gpu) else Context.cpu()
+
+      val path = s"${erul.outputPath}${File.separator}${erul.profilerName}"
+      val kwargs = Map("file_name" -> path, "profile_" + erul.profilerMode -> 
"1")
+      Profiler.profilerSetConfig(kwargs)
+      logger.info(s"profile file save to $path")
+
+      val A = Symbol.Variable("A")
+      val B = Symbol.Variable("B")
+      val C = Symbol.dot()(A, B)()
 
 Review comment:
   Please use `Symbol.api.dot()`

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


With regards,
Apache Git Services

Reply via email to