diff --git a/bin/hipify-perl b/bin/hipify-perl index 517b60ab..be25d21d 100755 --- a/bin/hipify-perl +++ b/bin/hipify-perl @@ -2117,6 +2117,12 @@ sub rocSubstitutions { subst("curandCreateGeneratorHost", "rocrand_create_generator_host_blocking", "library"); subst("curandDestroyGenerator", "rocrand_destroy_generator", "library"); subst("curandGenerate", "rocrand_generate", "library"); + subst("curandGenerateLogNormal", "rocrand_generate_log_normal", "library"); + subst("curandGenerateLongLong", "rocrand_generate_long_long", "library"); + subst("curandGenerateNormal", "rocrand_generate_normal", "library"); + subst("curandGenerateNormalDouble", "rocrand_generate_normal_double", "library"); + subst("curandGenerateUniform", "rocrand_generate_uniform", "library"); + subst("curandGenerateUniformDouble", "rocrand_generate_uniform_double", "library"); subst("cusolverDnCpotrf", "rocsolver_cpotrf", "library"); subst("cusolverDnCreate", "rocblas_create_handle", "library"); subst("cusolverDnDestroy", "rocblas_destroy_handle", "library"); @@ -4839,6 +4845,7 @@ sub simpleSubstitutions { subst("curandGenerate", "hiprandGenerate", "library"); subst("curandGenerateLogNormal", "hiprandGenerateLogNormal", "library"); subst("curandGenerateLogNormalDouble", "hiprandGenerateLogNormalDouble", "library"); + subst("curandGenerateLongLong", "hiprandGenerateLongLong", "library"); subst("curandGenerateNormal", "hiprandGenerateNormal", "library"); subst("curandGenerateNormalDouble", "hiprandGenerateNormalDouble", "library"); subst("curandGeneratePoisson", "hiprandGeneratePoisson", "library"); @@ -9313,7 +9320,6 @@ sub warnUnsupportedFunctions { "curandHistogramM2K_t", "curandHistogramM2K_st", "curandGetProperty", - "curandGenerateLongLong", "curandDistribution_t", "curandDistribution_st", "curandDistributionShift_t", diff --git a/docs/tables/CURAND_API_supported_by_HIP.md b/docs/tables/CURAND_API_supported_by_HIP.md index c3b0354f..e26dd0af 100644 --- a/docs/tables/CURAND_API_supported_by_HIP.md +++ b/docs/tables/CURAND_API_supported_by_HIP.md @@ -112,7 +112,7 @@ |`curandGenerate`| | | | |`hiprandGenerate`|1.5.0| | | | | |`curandGenerateLogNormal`| | | | |`hiprandGenerateLogNormal`|1.5.0| | | | | |`curandGenerateLogNormalDouble`| | | | |`hiprandGenerateLogNormalDouble`|1.5.0| | | | | -|`curandGenerateLongLong`| | | | | | | | | | | +|`curandGenerateLongLong`| | | | |`hiprandGenerateLongLong`|5.5.0| | | | | |`curandGenerateNormal`| | | | |`hiprandGenerateNormal`|1.5.0| | | | | |`curandGenerateNormalDouble`| | | | |`hiprandGenerateNormalDouble`|1.5.0| | | | | |`curandGeneratePoisson`| | | | |`hiprandGeneratePoisson`|1.5.0| | | | | diff --git a/docs/tables/CURAND_API_supported_by_HIP_and_ROC.md b/docs/tables/CURAND_API_supported_by_HIP_and_ROC.md index d8298b6d..357e442d 100644 --- a/docs/tables/CURAND_API_supported_by_HIP_and_ROC.md +++ b/docs/tables/CURAND_API_supported_by_HIP_and_ROC.md @@ -110,15 +110,15 @@ |`curandDestroyDistribution`| | | | |`hiprandDestroyDistribution`|1.5.0| | | | | | | | | | | |`curandDestroyGenerator`| | | | |`hiprandDestroyGenerator`|1.5.0| | | | |`rocrand_destroy_generator`|1.5.0| | | | | |`curandGenerate`| | | | |`hiprandGenerate`|1.5.0| | | | |`rocrand_generate`|1.5.0| | | | | -|`curandGenerateLogNormal`| | | | |`hiprandGenerateLogNormal`|1.5.0| | | | | | | | | | | +|`curandGenerateLogNormal`| | | | |`hiprandGenerateLogNormal`|1.5.0| | | | |`rocrand_generate_log_normal`|1.5.0| | | | | |`curandGenerateLogNormalDouble`| | | | |`hiprandGenerateLogNormalDouble`|1.5.0| | | | | | | | | | | -|`curandGenerateLongLong`| | | | | | | | | | | | | | | | | -|`curandGenerateNormal`| | | | |`hiprandGenerateNormal`|1.5.0| | | | | | | | | | | -|`curandGenerateNormalDouble`| | | | |`hiprandGenerateNormalDouble`|1.5.0| | | | | | | | | | | +|`curandGenerateLongLong`| | | | |`hiprandGenerateLongLong`|5.5.0| | | | |`rocrand_generate_long_long`|5.4.0| | | | | +|`curandGenerateNormal`| | | | |`hiprandGenerateNormal`|1.5.0| | | | |`rocrand_generate_normal`|1.5.0| | | | | +|`curandGenerateNormalDouble`| | | | |`hiprandGenerateNormalDouble`|1.5.0| | | | |`rocrand_generate_normal_double`|1.5.0| | | | | |`curandGeneratePoisson`| | | | |`hiprandGeneratePoisson`|1.5.0| | | | | | | | | | | |`curandGenerateSeeds`| | | | |`hiprandGenerateSeeds`|1.5.0| | | | | | | | | | | -|`curandGenerateUniform`| | | | |`hiprandGenerateUniform`|1.5.0| | | | | | | | | | | -|`curandGenerateUniformDouble`| | | | |`hiprandGenerateUniformDouble`|1.5.0| | | | | | | | | | | +|`curandGenerateUniform`| | | | |`hiprandGenerateUniform`|1.5.0| | | | |`rocrand_generate_uniform`|1.5.0| | | | | +|`curandGenerateUniformDouble`| | | | |`hiprandGenerateUniformDouble`|1.5.0| | | | |`rocrand_generate_uniform_double`|1.5.0| | | | | |`curandGetDirectionVectors32`| | | | |`hiprandGetDirectionVectors32`|6.0.0| | | | | | | | | | | |`curandGetDirectionVectors64`| | | | |`hiprandGetDirectionVectors64`|6.0.0| | | | | | | | | | | |`curandGetProperty`|8.0| | | | | | | | | | | | | | | | diff --git a/docs/tables/CURAND_API_supported_by_ROC.md b/docs/tables/CURAND_API_supported_by_ROC.md index 7c1103d4..6a081fea 100644 --- a/docs/tables/CURAND_API_supported_by_ROC.md +++ b/docs/tables/CURAND_API_supported_by_ROC.md @@ -110,15 +110,15 @@ |`curandDestroyDistribution`| | | | | | | | | | | |`curandDestroyGenerator`| | | | |`rocrand_destroy_generator`|1.5.0| | | | | |`curandGenerate`| | | | |`rocrand_generate`|1.5.0| | | | | -|`curandGenerateLogNormal`| | | | | | | | | | | +|`curandGenerateLogNormal`| | | | |`rocrand_generate_log_normal`|1.5.0| | | | | |`curandGenerateLogNormalDouble`| | | | | | | | | | | -|`curandGenerateLongLong`| | | | | | | | | | | -|`curandGenerateNormal`| | | | | | | | | | | -|`curandGenerateNormalDouble`| | | | | | | | | | | +|`curandGenerateLongLong`| | | | |`rocrand_generate_long_long`|5.4.0| | | | | +|`curandGenerateNormal`| | | | |`rocrand_generate_normal`|1.5.0| | | | | +|`curandGenerateNormalDouble`| | | | |`rocrand_generate_normal_double`|1.5.0| | | | | |`curandGeneratePoisson`| | | | | | | | | | | |`curandGenerateSeeds`| | | | | | | | | | | -|`curandGenerateUniform`| | | | | | | | | | | -|`curandGenerateUniformDouble`| | | | | | | | | | | +|`curandGenerateUniform`| | | | |`rocrand_generate_uniform`|1.5.0| | | | | +|`curandGenerateUniformDouble`| | | | |`rocrand_generate_uniform_double`|1.5.0| | | | | |`curandGetDirectionVectors32`| | | | | | | | | | | |`curandGetDirectionVectors64`| | | | | | | | | | | |`curandGetProperty`|8.0| | | | | | | | | | diff --git a/src/CUDA2HIP_RAND_API_functions.cpp b/src/CUDA2HIP_RAND_API_functions.cpp index aa64b7f4..6f3a7f3f 100644 --- a/src/CUDA2HIP_RAND_API_functions.cpp +++ b/src/CUDA2HIP_RAND_API_functions.cpp @@ -31,15 +31,15 @@ const std::map CUDA_RAND_FUNCTION_MAP { {"curandDestroyDistribution", {"hiprandDestroyDistribution", "", CONV_LIB_FUNC, API_RAND, 2}}, {"curandDestroyGenerator", {"hiprandDestroyGenerator", "rocrand_destroy_generator", CONV_LIB_FUNC, API_RAND, 2}}, {"curandGenerate", {"hiprandGenerate", "rocrand_generate", CONV_LIB_FUNC, API_RAND, 2}}, - {"curandGenerateLogNormal", {"hiprandGenerateLogNormal", "", CONV_LIB_FUNC, API_RAND, 2}}, + {"curandGenerateLogNormal", {"hiprandGenerateLogNormal", "rocrand_generate_log_normal", CONV_LIB_FUNC, API_RAND, 2}}, {"curandGenerateLogNormalDouble", {"hiprandGenerateLogNormalDouble", "", CONV_LIB_FUNC, API_RAND, 2}}, - {"curandGenerateLongLong", {"hiprandGenerateLongLong", "", CONV_LIB_FUNC, API_RAND, 2, HIP_UNSUPPORTED}}, - {"curandGenerateNormal", {"hiprandGenerateNormal", "", CONV_LIB_FUNC, API_RAND, 2}}, - {"curandGenerateNormalDouble", {"hiprandGenerateNormalDouble", "", CONV_LIB_FUNC, API_RAND, 2}}, + {"curandGenerateLongLong", {"hiprandGenerateLongLong", "rocrand_generate_long_long", CONV_LIB_FUNC, API_RAND, 2}}, + {"curandGenerateNormal", {"hiprandGenerateNormal", "rocrand_generate_normal", CONV_LIB_FUNC, API_RAND, 2}}, + {"curandGenerateNormalDouble", {"hiprandGenerateNormalDouble", "rocrand_generate_normal_double", CONV_LIB_FUNC, API_RAND, 2}}, {"curandGeneratePoisson", {"hiprandGeneratePoisson", "", CONV_LIB_FUNC, API_RAND, 2}}, {"curandGenerateSeeds", {"hiprandGenerateSeeds", "", CONV_LIB_FUNC, API_RAND, 2}}, - {"curandGenerateUniform", {"hiprandGenerateUniform", "", CONV_LIB_FUNC, API_RAND, 2}}, - {"curandGenerateUniformDouble", {"hiprandGenerateUniformDouble", "", CONV_LIB_FUNC, API_RAND, 2}}, + {"curandGenerateUniform", {"hiprandGenerateUniform", "rocrand_generate_uniform", CONV_LIB_FUNC, API_RAND, 2}}, + {"curandGenerateUniformDouble", {"hiprandGenerateUniformDouble", "rocrand_generate_uniform_double", CONV_LIB_FUNC, API_RAND, 2}}, {"curandGetDirectionVectors32", {"hiprandGetDirectionVectors32", "", CONV_LIB_FUNC, API_RAND, 2}}, {"curandGetDirectionVectors64", {"hiprandGetDirectionVectors64", "", CONV_LIB_FUNC, API_RAND, 2}}, {"curandGetProperty", {"hiprandGetProperty", "", CONV_LIB_FUNC, API_RAND, 2, HIP_UNSUPPORTED}}, @@ -141,11 +141,18 @@ const std::map HIP_RAND_FUNCTION_VER_MAP { {"hiprandGetScrambleConstants32", {HIP_6000, HIP_0, HIP_0 }}, {"hiprandGetScrambleConstants64", {HIP_6000, HIP_0, HIP_0 }}, {"hiprandSetGeneratorOrdering", {HIP_6020, HIP_0, HIP_0, }}, + {"hiprandGenerateLongLong", {HIP_5050, HIP_0, HIP_0, }}, {"rocrand_create_generator", {HIP_1050, HIP_0, HIP_0, }}, {"rocrand_create_generator_host_blocking", {HIP_6020, HIP_0, HIP_0, }}, {"rocrand_destroy_generator", {HIP_1050, HIP_0, HIP_0, }}, {"rocrand_generate", {HIP_1050, HIP_0, HIP_0, }}, + {"rocrand_generate_long_long", {HIP_5040, HIP_0, HIP_0, }}, + {"rocrand_generate_uniform", {HIP_1050, HIP_0, HIP_0, }}, + {"rocrand_generate_uniform_double", {HIP_1050, HIP_0, HIP_0, }}, + {"rocrand_generate_normal", {HIP_1050, HIP_0, HIP_0, }}, + {"rocrand_generate_normal_double", {HIP_1050, HIP_0, HIP_0, }}, + {"rocrand_generate_log_normal", {HIP_1050, HIP_0, HIP_0, }}, }; const std::map CUDA_RAND_API_SECTION_MAP { diff --git a/tests/unit_tests/libraries/cuRAND/benchmark_curand_generate.cpp b/tests/unit_tests/libraries/cuRAND/benchmark_curand_generate.cpp index 4bf77d11..1e52240f 100644 --- a/tests/unit_tests/libraries/cuRAND/benchmark_curand_generate.cpp +++ b/tests/unit_tests/libraries/cuRAND/benchmark_curand_generate.cpp @@ -74,13 +74,13 @@ void run_benchmark(const cli::Parser& parser, const rng_type_t rng_type, CUDA_CALL(cudaMalloc((void**)&data, size * sizeof(T))); // CHECK: hiprandGenerator_t generator; - // CHECK: CURAND_CALL(hiprandCreateGenerator(&generator, rng_type)); + // CHECK-NEXT: CURAND_CALL(hiprandCreateGenerator(&generator, rng_type)); curandGenerator_t generator; CURAND_CALL(curandCreateGenerator(&generator, rng_type)); const size_t dimensions = parser.get("dimensions"); // CHECK: hiprandStatus_t status = hiprandSetQuasiRandomGeneratorDimensions(generator, dimensions); - // CHECK: if (status != HIPRAND_STATUS_TYPE_ERROR) + // CHECK-NEXT: if (status != HIPRAND_STATUS_TYPE_ERROR) curandStatus_t status = curandSetQuasiRandomGeneratorDimensions(generator, dimensions); if (status != CURAND_STATUS_TYPE_ERROR) // If the RNG is not quasi-random { @@ -113,7 +113,7 @@ void run_benchmark(const cli::Parser& parser, const rng_type_t rng_type, << " ms, Time (all) = " << std::setw(8) << elapsed.count() << " ms, Size = " << size << std::endl; // CHECK: CURAND_CALL(hiprandDestroyGenerator(generator)); - // CHECK: CUDA_CALL(hipFree(data)); + // CHECK-NEXT: CUDA_CALL(hipFree(data)); CURAND_CALL(curandDestroyGenerator(generator)); CUDA_CALL(cudaFree(data)); } @@ -122,7 +122,7 @@ void run_benchmarks(const cli::Parser& parser, const rng_type_t rng_type, const std::string& distribution) { if (distribution == "uniform-uint") { // CHECK: if (rng_type != HIPRAND_RNG_QUASI_SOBOL64 && - // CHECK: rng_type != HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64) { + // CHECK-NEXT: rng_type != HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64) { if (rng_type != CURAND_RNG_QUASI_SOBOL64 && rng_type != CURAND_RNG_QUASI_SCRAMBLED_SOBOL64) { run_benchmark( @@ -136,15 +136,14 @@ void run_benchmarks(const cli::Parser& parser, const rng_type_t rng_type, } if (distribution == "uniform-long-long") { // CHECK: if (rng_type == HIPRAND_RNG_QUASI_SOBOL64 || - // CHECK: rng_type == HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64) + // CHECK-NEXT: rng_type == HIPRAND_RNG_QUASI_SCRAMBLED_SOBOL64) if (rng_type == CURAND_RNG_QUASI_SOBOL64 || rng_type == CURAND_RNG_QUASI_SCRAMBLED_SOBOL64) { run_benchmark( parser, rng_type, // CHECK: [](hiprandGenerator_t gen, unsigned long long* data, size_t size) { [](curandGenerator_t gen, unsigned long long* data, size_t size) { - // curandGenerateLongLong is yet unsupported by HIP - // CHECK-NOT: return hiprandGenerateLongLong(gen, data, size); + // CHECK: return hiprandGenerateLongLong(gen, data, size); return curandGenerateLongLong(gen, data, size); }); } @@ -152,7 +151,7 @@ void run_benchmarks(const cli::Parser& parser, const rng_type_t rng_type, if (distribution == "uniform-float") { run_benchmark(parser, rng_type, // CHECK: [](hiprandGenerator_t gen, float* data, size_t size) { - // CHECK: return hiprandGenerateUniform(gen, data, size); + // CHECK-NEXT: return hiprandGenerateUniform(gen, data, size); [](curandGenerator_t gen, float* data, size_t size) { return curandGenerateUniform(gen, data, size); }); @@ -160,7 +159,7 @@ void run_benchmarks(const cli::Parser& parser, const rng_type_t rng_type, if (distribution == "uniform-double") { run_benchmark(parser, rng_type, // CHECK: [](hiprandGenerator_t gen, double* data, size_t size) { - // CHECK: return hiprandGenerateUniformDouble(gen, data, size); + // CHECK-NEXT: return hiprandGenerateUniformDouble(gen, data, size); [](curandGenerator_t gen, double* data, size_t size) { return curandGenerateUniformDouble(gen, data, size); }); @@ -168,7 +167,7 @@ void run_benchmarks(const cli::Parser& parser, const rng_type_t rng_type, if (distribution == "normal-float") { run_benchmark(parser, rng_type, // CHECK: [](hiprandGenerator_t gen, float* data, size_t size) { - // CHECK: return hiprandGenerateNormal(gen, data, size, 0.0f, 1.0f); + // CHECK-NEXT: return hiprandGenerateNormal(gen, data, size, 0.0f, 1.0f); [](curandGenerator_t gen, float* data, size_t size) { return curandGenerateNormal(gen, data, size, 0.0f, 1.0f); }); @@ -177,7 +176,7 @@ void run_benchmarks(const cli::Parser& parser, const rng_type_t rng_type, run_benchmark( parser, rng_type, // CHECK: [](hiprandGenerator_t gen, double* data, size_t size) { - // CHECK: return hiprandGenerateNormalDouble(gen, data, size, 0.0, 1.0); + // CHECK-NEXT: return hiprandGenerateNormalDouble(gen, data, size, 0.0, 1.0); [](curandGenerator_t gen, double* data, size_t size) { return curandGenerateNormalDouble(gen, data, size, 0.0, 1.0); }); @@ -185,7 +184,7 @@ void run_benchmarks(const cli::Parser& parser, const rng_type_t rng_type, if (distribution == "log-normal-float") { run_benchmark(parser, rng_type, // CHECK: [](hiprandGenerator_t gen, float* data, size_t size) { - // CHECK: return hiprandGenerateLogNormal(gen, data, size, 0.0f, 1.0f); + // CHECK-NEXT: return hiprandGenerateLogNormal(gen, data, size, 0.0f, 1.0f); [](curandGenerator_t gen, float* data, size_t size) { return curandGenerateLogNormal(gen, data, size, 0.0f, 1.0f); }); @@ -194,7 +193,7 @@ void run_benchmarks(const cli::Parser& parser, const rng_type_t rng_type, run_benchmark( parser, rng_type, // CHECK: [](hiprandGenerator_t gen, double* data, size_t size) { - // CHECK: return hiprandGenerateLogNormalDouble(gen, data, size, 0.0, 1.0); + // CHECK-NEXT: return hiprandGenerateLogNormalDouble(gen, data, size, 0.0, 1.0); [](curandGenerator_t gen, double* data, size_t size) { return curandGenerateLogNormalDouble(gen, data, size, 0.0, 1.0); }); @@ -207,7 +206,7 @@ void run_benchmarks(const cli::Parser& parser, const rng_type_t rng_type, run_benchmark( parser, rng_type, // CHECK: [lambda](hiprandGenerator_t gen, unsigned int* data, size_t size) { - // CHECK: return hiprandGeneratePoisson(gen, data, size, lambda); + // CHECK-NEXT: return hiprandGeneratePoisson(gen, data, size, lambda); [lambda](curandGenerator_t gen, unsigned int* data, size_t size) { return curandGeneratePoisson(gen, data, size, lambda); }); @@ -219,9 +218,9 @@ const std::vector all_engines = { "xorwow", "mrg32k3a", "mtgp32", // "mt19937", "philox", "sobol32", - // "scrambled_sobol32", - // "sobol64", - // "scrambled_sobol64", + "scrambled_sobol32", + "sobol64", + "scrambled_sobol64", }; const std::vector all_distributions = { @@ -287,8 +286,8 @@ int main(int argc, char* argv[]) { CUDA_CALL(cudaRuntimeGetVersion(&runtime_version)); int device_id; // CHECK: CUDA_CALL(hipGetDevice(&device_id)); - // CHECK: hipDeviceProp_t props; - // CHECK: CUDA_CALL(hipGetDeviceProperties(&props, device_id)); + // CHECK-NEXT: hipDeviceProp_t props; + // CHECK-NEXT: CUDA_CALL(hipGetDeviceProperties(&props, device_id)); CUDA_CALL(cudaGetDevice(&device_id)); cudaDeviceProp props; CUDA_CALL(cudaGetDeviceProperties(&props, device_id)); diff --git a/tests/unit_tests/synthetic/libraries/curand2hiprand.cu b/tests/unit_tests/synthetic/libraries/curand2hiprand.cu index cec61e9a..da79a875 100644 --- a/tests/unit_tests/synthetic/libraries/curand2hiprand.cu +++ b/tests/unit_tests/synthetic/libraries/curand2hiprand.cu @@ -19,7 +19,17 @@ int main() { printf("21. cuRAND API to hipRAND API synthetic test\n"); unsigned int *outputPtr = nullptr; + float *outputPtrFloat = nullptr; + double *outputPtrDouble = nullptr; size_t num = 0; + float mean = 0.f; + float stddev = 0.f; + +#if defined(_WIN32) + unsigned long long *outputPtrUll = nullptr; +#else + unsigned long *outputPtrUll = nullptr; +#endif // CHECK: hiprandStatus randStatus; // CHECK-NEXT: hiprandStatus_t status; @@ -164,6 +174,36 @@ int main() { // CHECK: status = hiprandGenerate(randGenerator, outputPtr, num); status = curandGenerate(randGenerator, outputPtr, num); + // CUDA: curandStatus_t CURANDAPI curandGenerateLogNormal(curandGenerator_t generator, float *outputPtr, size_t n, float mean, float stddev); + // HIP: hiprandStatus_t HIPRANDAPI hiprandGenerateLogNormal(hiprandGenerator_t generator, float * output_data, size_t n, float mean, float stddev); + // CHECK: status = hiprandGenerateLogNormal(randGenerator, outputPtrFloat, num, mean, stddev); + status = curandGenerateLogNormal(randGenerator, outputPtrFloat, num, mean, stddev); + + // CUDA: curandStatus_t CURANDAPI curandGenerateLongLong(curandGenerator_t generator, unsigned long long *outputPtr, size_t num); + // HIP: hiprandStatus_t HIPRANDAPI hiprandGenerateLongLong(hiprandGenerator_t generator, unsigned long long* output_data, size_t n); + // CHECK: status = hiprandGenerateLongLong(randGenerator, outputPtrUll, num); + status = curandGenerateLongLong(randGenerator, outputPtrUll, num); + + // CUDA: curandStatus_t CURANDAPI curandGenerateNormal(curandGenerator_t generator, float *outputPtr, size_t n, float mean, float stddev); + // HIP: hiprandStatus_t HIPRANDAPI hiprandGenerateNormal(hiprandGenerator_t generator, float * output_data, size_t n, float mean, float stddev); + // CHECK: status = hiprandGenerateNormal(randGenerator, outputPtrFloat, num, mean, stddev); + status = curandGenerateNormal(randGenerator, outputPtrFloat, num, mean, stddev); + + // CUDA: curandStatus_t CURANDAPI curandGenerateNormalDouble(curandGenerator_t generator, double *outputPtr, size_t n, double mean, double stddev); + // HIP: hiprandStatus_t HIPRANDAPI hiprandGenerateNormalDouble(hiprandGenerator_t generator, double * output_data, size_t n, double mean, double stddev); + // CHECK: status = hiprandGenerateNormalDouble(randGenerator, outputPtrDouble, num, mean, stddev); + status = curandGenerateNormalDouble(randGenerator, outputPtrDouble, num, mean, stddev); + + // CUDA: curandStatus_t CURANDAPI curandGenerateUniform(curandGenerator_t generator, float *outputPtr, size_t num); + // HIP: hiprandStatus_t HIPRANDAPI hiprandGenerateUniform(hiprandGenerator_t generator, float * output_data, size_t n); + // CHECK: status = hiprandGenerateUniform(randGenerator, outputPtrFloat, num); + status = curandGenerateUniform(randGenerator, outputPtrFloat, num); + + // CUDA: curandStatus_t CURANDAPI curandGenerateUniformDouble(curandGenerator_t generator, double *outputPtr, size_t num); + // HIP: hiprandStatus_t HIPRANDAPI hiprandGenerateUniformDouble(hiprandGenerator_t generator, double * output_data, size_t n); + // CHECK: status = hiprandGenerateUniformDouble(randGenerator, outputPtrDouble, num); + status = curandGenerateUniformDouble(randGenerator, outputPtrDouble, num); + #if CUDA_VERSION >= 11000 && CURAND_VERSION >= 10200 // CHECK: hiprandOrdering_t RAND_ORDERING_PSEUDO_LEGACY = HIPRAND_ORDERING_PSEUDO_LEGACY; curandOrdering_t RAND_ORDERING_PSEUDO_LEGACY = CURAND_ORDERING_PSEUDO_LEGACY; diff --git a/tests/unit_tests/synthetic/libraries/curand2rocrand.cu b/tests/unit_tests/synthetic/libraries/curand2rocrand.cu index f54e5e4b..14c974b7 100644 --- a/tests/unit_tests/synthetic/libraries/curand2rocrand.cu +++ b/tests/unit_tests/synthetic/libraries/curand2rocrand.cu @@ -11,7 +11,17 @@ int main() { printf("21.1. cuRAND API to rocRAND API synthetic test\n"); unsigned int *outputPtr = nullptr; + float *outputPtrFloat = nullptr; + double *outputPtrDouble = nullptr; size_t num = 0; + float mean = 0.f; + float stddev = 0.f; + +#if defined(_WIN32) + unsigned long long *outputPtrUll = nullptr; +#else + unsigned long *outputPtrUll = nullptr; +#endif // CHECK: rocrand_status randStatus; // CHECK-NEXT: rocrand_status status; @@ -38,7 +48,6 @@ int main() { curandStatus_t STATUS_LAUNCH_FAILURE = CURAND_STATUS_LAUNCH_FAILURE; curandStatus_t STATUS_INTERNAL_ERROR = CURAND_STATUS_INTERNAL_ERROR; - // CHECK: rocrand_rng_type randRngType; // CHECK-NEXT: rocrand_rng_type randRngType_t; // CHECK-NEXT: rocrand_rng_type RNG_PSEUDO_DEFAULT = ROCRAND_RNG_PSEUDO_DEFAULT; @@ -115,6 +124,36 @@ int main() { // CHECK: status = rocrand_generate(randGenerator, outputPtr, num); status = curandGenerate(randGenerator, outputPtr, num); + // CUDA: curandStatus_t CURANDAPI curandGenerateLogNormal(curandGenerator_t generator, float *outputPtr, size_t n, float mean, float stddev); + // ROC: rocrand_status ROCRANDAPI rocrand_generate_log_normal(rocrand_generator generator, float * output_data, size_t n, float mean, float stddev); + // CHECK: status = rocrand_generate_log_normal(randGenerator, outputPtrFloat, num, mean, stddev); + status = curandGenerateLogNormal(randGenerator, outputPtrFloat, num, mean, stddev); + + // CUDA: curandStatus_t CURANDAPI curandGenerateLongLong(curandGenerator_t generator, unsigned long long *outputPtr, size_t num); + // ROC: rocrand_status ROCRANDAPI rocrand_generate_long_long(rocrand_generator generator, unsigned long long int* output_data, size_t n); + // CHECK: status = rocrand_generate_long_long(randGenerator, outputPtrUll, num); + status = curandGenerateLongLong(randGenerator, outputPtrUll, num); + + // CUDA: curandStatus_t CURANDAPI curandGenerateNormal(curandGenerator_t generator, float *outputPtr, size_t n, float mean, float stddev); + // ROC: rocrand_status ROCRANDAPI rocrand_generate_normal(rocrand_generator generator, float * output_data, size_t n, float mean, float stddev); + // CHECK: status = rocrand_generate_normal(randGenerator, outputPtrFloat, num, mean, stddev); + status = curandGenerateNormal(randGenerator, outputPtrFloat, num, mean, stddev); + + // CUDA: curandStatus_t CURANDAPI curandGenerateNormalDouble(curandGenerator_t generator, double *outputPtr, size_t n, double mean, double stddev); + // ROC: rocrand_status ROCRANDAPI rocrand_generate_normal_double(rocrand_generator generator, double * output_data, size_t n, double mean, double stddev); + // CHECK: status = rocrand_generate_normal_double(randGenerator, outputPtrDouble, num, mean, stddev); + status = curandGenerateNormalDouble(randGenerator, outputPtrDouble, num, mean, stddev); + + // CUDA: curandStatus_t CURANDAPI curandGenerateUniform(curandGenerator_t generator, float *outputPtr, size_t num); + // ROC: rocrand_status ROCRANDAPI rocrand_generate_uniform(rocrand_generator generator, float * output_data, size_t n); + // CHECK: status = rocrand_generate_uniform(randGenerator, outputPtrFloat, num); + status = curandGenerateUniform(randGenerator, outputPtrFloat, num); + + // CUDA: curandStatus_t CURANDAPI curandGenerateUniformDouble(curandGenerator_t generator, double *outputPtr, size_t num); + // ROC: rocrand_status ROCRANDAPI rocrand_generate_uniform_double(rocrand_generator generator, double * output_data, size_t n); + // CHECK: status = rocrand_generate_uniform_double(randGenerator, outputPtrDouble, num); + status = curandGenerateUniformDouble(randGenerator, outputPtrDouble, num); + #if CUDA_VERSION >= 11000 && CURAND_VERSION >= 10200 // CHECK: rocrand_ordering RAND_ORDERING_PSEUDO_LEGACY = ROCRAND_ORDERING_PSEUDO_LEGACY; curandOrdering_t RAND_ORDERING_PSEUDO_LEGACY = CURAND_ORDERING_PSEUDO_LEGACY;