Author Topic: BCX and CUDA  (Read 475 times)

Herseem

  • Newbie
  • *
  • Posts: 1
    • View Profile
BCX and CUDA
« on: December 13, 2022, 01:15:00 PM »
Hi,

Has anyone incorporated CUDA into BCX BASIC? My plan was to convert a simulation program from another basic into this basic, generate the C++ and then do the CUDA bit, but that would mean redoing that for every change to the original basic. I was wondering if there was a way of incorporating CUDA into the basic in the first place so that less conversion was needed to be done each time. I couldn't find CUDA mentioned when I searched the forum.

Mike

MrBcx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1850
    • View Profile
Re: BCX and CUDA
« Reply #1 on: December 13, 2022, 04:17:09 PM »
Hi Mike and welcome.

I know next to nothing about CUDA.

I found this page ( https://developer.nvidia.com/blog/even-easier-introduction-cuda/ ) and
subsequently downloaded and sucessfully installed the CUDA toolkit/compiler for MSVS 2022 and
attempted to work though the example. I never obtained a successful build, I assume because I
don't have an NVIDA GPU in my PC.

Two things I can tell you is that BCX does support inline ASM code, similar to FreeBasic and
BCX has a special symbol ... the ! symbol ... which basically tells BCX to leave everything to the right
of the ! symbol untouched.  So, using the example linked above, one could include the CUDA macro
_global_ inside the BCX source code as:

! _global_

With that simple understanding, any other CUDA compiler ( nvcc ) directives, assembly, or C/C++ code that
you want to embed inside a BCX BASIC source file should work like that as well.

Hopefully this bit of advice gives you a starting point.

References:

https://bcxbasiccoders.com/webhelp/html/assembly.htm#asm

https://bcxbasiccoders.com/webhelp/html/embeddedc.htm#bang
« Last Edit: December 13, 2022, 04:22:14 PM by MrBcx »