ClassNotFound error

67 views
Skip to first unread message

Rupak Kundu

unread,
Feb 5, 2021, 1:38:13 PM2/5/21
to Spatial Users
Hello everyone 
I have compiled the GEMM program successfully.
I have written a simple code from tutorials page " Hello Spatial" under section " DRAMS and transfers" . I changed the object name HelloSpatial and kept the rest of code unchanged. 
On run bin/spatial I get the error ClassNotFoundException.

how can I resolve it ? 

Rupak
 

stan...@stanford.edu

unread,
Feb 8, 2021, 9:49:39 PM2/8/21
to Spatial Users
Hi Rupak,

Are you in the right path for your project? bin/spatial is sensitive to the location of your project.

Thanks,
Nathan

Rupak Kundu

unread,
Feb 9, 2021, 3:26:35 AM2/9/21
to Spatial Users
Hii 

This is first program on spatial. I have created a file Drmt.scala in path Spatial-quickstart/src/main/scala. . 

I have tried compiling the file from 2 paths

1) from spatial-quiackstart. Using bin/spatial src/main/scala/drmt.scala. This gives the class not found error (i mentioned in previous message). I am using the same source code from Spatial tutorial (section DRAMS and transfers) . I have put object name as Drmt. I am unable to compile it due to above error. I am able t compile already provided GEMM.scala using same process. I am new to JAVA/Scala also. 

2) I tried compiling from path of source code src/main/scala/drmt.scala . This is not compiling says object spatial not found.  GEMM is also not cmpiling using this prcess.

I am stuck. I appreciate any help regarding this.

Thanks for your time.

Rupak

Matt Feldman

unread,
Feb 10, 2021, 12:10:38 AM2/10/21
to Spatial Users
Hi Rupak,

I was trying to reproduce this problem.  Can you let me know where I went wrong?

Created the following file ~/spatial-quickstart/src/main/scala/drmt.scala:
```
import spatial.dsl._

@spatial object drmt extends SpatialApp {
  def main(args: Array[String]): Void = {
    // Create DRAM (malloc)
    val d = DRAM[Int](16)

    // Set DRAM (memcpy)
    val data = Array.fill[Int](16)(0)
    setMem(d, data)

    Accel {
      // Create 16-element SRAM
      val s = SRAM[Int](16)

      // Transfer data from d to s
      s load d(0::16)

      // Add number to each element
      Foreach(16 by 1){i => s(i) = s(i) + i}

      // Transfer data back to d
      d(0::16) store s
    }
    
    // Print contents in memory
    printArray(getMem(d), "Result: ")

  }
}
```

cd ~/spatial-quickstart
bin/spatial drmt --sim

This compiled the app.  When you said you used "bin/spatial src/main/scala/drmt.scala", you you mean you ran this command verbatim?  I was able to confirm the error is the "class not found exception" if this is the case.  Or did running "bin/spatial drmt" actually fail to find the class, in which case I did something wrong here?

Thanks,
Matt

Rupak Kundu

unread,
Feb 10, 2021, 2:56:57 AM2/10/21
to Spatial Users
Hi Matt 

thanks !! so I was running command verbatim (thats what I had done for GEMM and Hello world application) . When I ran the command without .scala it runs successfully..

Thanks Rupak
Reply all
Reply to author
Forward
0 new messages