Skip to content

Float versus float Compile Error #70

@jasonltorchinsky

Description

@jasonltorchinsky

In the latest few changes, a new error was introduced:

/src_kernels_cuda_rt/../include_rt/raytracer_functions.h(115): error: argument of type "const Float *" is incompatible with parameter of type "const float *"
          const int i = min(max(0, find_index(mie_cdf, n_mie, random_number)), n_mie - 2);
                                              ^

1 error detected in the compilation of "/src_kernels_cuda_rt/raytracer_kernels.cu".
make[2]: *** [src_kernels_cuda_rt/CMakeFiles/rte_rrtmgp_kernels_cuda_rt.dir/build.make:122: src_kernels_cuda_rt/CMakeFiles/rte_rrtmgp_kernels_cuda_rt.dir/raytracer_kernels.cu.o] Error 2
make[1]: *** [CMakeFiles/Makefile2:318: src_kernels_cuda_rt/CMakeFiles/rte_rrtmgp_kernels_cuda_rt.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Straightforward fix on line 90 of /include_rt/raytracer_functions.h

    __device__
    inline int find_index(const float* mie_cdf, const int size, const float random_number)
    {
        int left = 0;
        int right = size - 1;

        while (left < right) {
            int mid = left + (right - left) / 2;

            if (random_number >= mie_cdf[mid]) {
                right = mid;
            } else {
                left = mid + 1;
            }
        }

        return left - 1;
    }

Changing float* to Float* fixes the compile issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions