Giter VIP home page Giter VIP logo

Comments (5)

emankov avatar emankov commented on August 30, 2024

Are you asking about compiling the CUDA source file or the hipified HIP source file?

from hipify.

ywj55555 avatar ywj55555 commented on August 30, 2024

Hello, file HIPIFY/tests/unit_tests/samples/2_Cookbook/11_texture_driver
/tex2dKernel.cpp, this is the cuda source code from HIP to CUDA. It can be compiled using nvcc, but there is an extern variable in this file: extern texture<float, 2, cudaReadModeElementType> tex; I want to know how to use NVCC or hipcc to compile and generate tex2dKernel .code, thinks.

from hipify.

ywj55555 avatar ywj55555 commented on August 30, 2024

Hello, file HIPIFY/tests/unit_tests/samples/2_Cookbook/11_texture_driver /tex2dKernel.cpp, this is the cuda source code from HIP to CUDA. It can be compiled using nvcc, but there is an extern variable in this file: extern texture<float, 2, cudaReadModeElementType> tex; I want to know how to use NVCC or hipcc to compile and generate tex2dKernel .code, thinks.

I changed "extern texture<float, 2, cudaReadModeElementType> tex; "in tex2dKernel.cpp to "#if CUDA_VERSION < 12000 texture<float, 2, cudaReadModeElementType> tex;#endif" which is in texture2dDrv.cpp, then delete the definition of the variable tex in texture2dDrv.cpp, and then convert it into a HIP program. Using the hipcc --genco tex2dKernel.cpp -o tex2dKernel .code command to compile successfully, but if using extern variables in tex2dKernel.cpp, I don’t know how to generate tex2dKernel .code. How can I achieve this? Thanks.

from hipify.

ywj55555 avatar ywj55555 commented on August 30, 2024

The tex variable is not used in texture2dDrv.cpp. texture2dDrv.cpp only obtains tex in the form of a string through cuModuleGetTexRef(&texref, Module, "tex"); therefore, should the declaration and definition of tex be placed in tex2dKernel. cpp file? Thanks.

from hipify.

emankov avatar emankov commented on August 30, 2024

It is unclear, why you want to compile this particular hipify-clang unit test, which is dedicated to internal hipification testing only, and doesn't even have an entry point.

Anyway, you may do it by the following additional steps:

  1. Add an entry point to the tex2dKernel.cpp, for instance:
int main(int argc, char** argv) {
  float out = 0.f;
  tex2dKernel<<<512, 512>>>(&out, 128, 128);
  return 0;
}
  1. Compile the tex2dKernel.cpp by nvcc < 12.0.0 (because of the deleted texture support in CUDA 12.0):

    a) without additional options to obtain executable;
    b) with --cubin to generate a Cubin from PTX intermediate file;
    c) with --fatbin to generate a Fat binary from the source.

or:

  1. Hipify the changed tex2dKernel.cpp source by hipify-clang.
  2. Compile the hipified tex2dKernel.cpp.hip either by hipcc script or directly by clang.

from hipify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.