harrism / sublimetext-cuda-cpp

CUDA C++ package for Sublime Text 2 & 3
BSD 3-Clause "New" or "Revised" License
67 stars 13 forks source link

suffixes #3

Closed cuiwei0322 closed 10 years ago

cuiwei0322 commented 10 years ago

Hello Harrism,

I have one problem about current cuda plugin. The "scope" in all snippets doesn't support the the file with ".cu" suffix, which is the default suffix in cuda. However, in your plugin, only ".cuda-c++" is supported, which is not recognized by "nvcc". If I use ".cu" as the source file suffix, many snippets in this plugin don't work.

Could you tell me how can I change the settings of this plugin?

Any help would be much appreciated!

Wei

harrism commented 10 years ago

Hi Wei,

Which snippets don't work? Can you point to an example?

source.cuda-c++ is the ScopeName for the package. Each snippet in the package has `source.cuda-c++, meaning it is active in that scope. And the package has FileTypes set to .cu, .cuh, and .h.

Make sure when you open a .cu file that the scope (lower right corner of the ST window) says "CUDA C++". If it doesn't, make sure the default for that file type isn't set differently click on that scope, select "Open all with current extension as..." and select "CUDA C++".

Mark

cuiwei0322 commented 10 years ago

screenshot from 2014-08-27 12 04 41

Hello Mark,

For example, the "for loop" and "printf" snippets works on the .cu file. But when I type "cuda", there is snippets shows. There should be something like "cudaMalloc" or "cudaMemcpy" shows.

please see the picture as reference.

Thanks

Wei

cuiwei0322 commented 10 years ago

Hello Mark,

I solved my problem. I should use "cmem" instead of "cuda" in invoke the snippets. I am new to cuda and sublime. sorry to trouble you.

By the way, could you tell me why do you use "g++" in the cuda build system instead of "nvcc"?

Thanks

harrism commented 10 years ago

I think it's possible to have multiple snippets with the same tabTrigger, so maybe it would be more useful to have all the CUDA API snippets just use cuda as the trigger -- I think it will pop up a list of options. I will try this out.

I don't think I ever set up a build system for this plugin. I don't use Sublime to build, only to edit. If someone provides me a suggestion on how to improve that (or pull request), I can incorporate it.

Thanks! Mark

On Thu, Aug 28, 2014 at 2:17 AM, cuiwei0322 notifications@github.com wrote:

Hello Mark,

I solved my problem. I should use "cmem" instead of "cuda" in invoke the snippets. I am new to cuda and sublime. sorry to trouble you.

By the way, could you tell me why do you use "g++" in the cuda build system instead of "nvcc"?

Thanks

Reply to this email directly or view it on GitHub https://github.com/harrism/sublimetext-cuda-cpp/issues/3#issuecomment-53599103 .

cuiwei0322 commented 10 years ago

Hello Mark,

I have write a simple build system for this cuda package.

Maybe we use it for build of simple cuda program.

The build is pasted here:

{ "cmd": ["nvcc", "-arch=sm_20", "$file", "-o", "${file_path}/${file_base_name}"], "fileregex": "^(..[^:]):([0-9]+):?([0-9]+)?:? (._)$", "working_dir": "${file_path}", "selector": "source.cu",

"variants":
[
    {
        "name": "Run",
        "cmd": ["bash", "-c", "nvcc -arch=sm_20 '${file}' -o '${file_path}/${file_base_name}' && '${file_path}/${file_base_name}'"]
    }
]

}

Wei