Skip to content

Commit f1642c4

Browse files
authored
Update RAPIDS accelerated native UDFs example to use static CUDA runtime (#354)
* Update RAPIDS accelerated native UDFs example to use static CUDA runtime Signed-off-by: Jason Lowe <[email protected]> * Improve native UDF example in README --------- Signed-off-by: Jason Lowe <[email protected]>
1 parent e1c8ef1 commit f1642c4

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

examples/UDF-Examples/RAPIDS-accelerated-UDFs/README.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -215,18 +215,17 @@ schema = StructType([
215215
StructField("c2", IntegerType()),
216216
])
217217
data = [
218-
("s1",1),
219-
("s2",2),
220-
("s1",3),
221-
("s2",3),
222-
("s1",3),
218+
("a b c d",1),
219+
("",2),
220+
(None,3),
221+
("the quick brown fox jumped over the lazy dog",3),
223222
]
224223
df = spark.createDataFrame(
225224
SparkContext.getOrCreate().parallelize(data, numSlices=2),
226225
schema)
227226
df.createOrReplaceTempView("tab")
228227
229228
spark.sql("CREATE TEMPORARY FUNCTION {} AS '{}'".format("wordcount", "com.nvidia.spark.rapids.udf.hive.StringWordCount"))
230-
spark.sql("select wordcount(c1) from tab group by c1").show()
231-
spark.sql("select wordcount(c1) from tab group by c1").explain()
229+
spark.sql("select c1, wordcount(c1) from tab").show()
230+
spark.sql("select c1, wordcount(c1) from tab").explain()
232231
```

examples/UDF-Examples/RAPIDS-accelerated-UDFs/src/main/cpp/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#=============================================================================
2-
# Copyright (c) 2021-2022, NVIDIA CORPORATION.
2+
# Copyright (c) 2021-2024, NVIDIA CORPORATION.
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -81,7 +81,7 @@ set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -w --expt-extended-lambda --expt-relax
8181
# - cudf -------------------------------------------------------------------------------------------
8282

8383
# Ensure CUDA runtime is dynamic despite statically linking Arrow in libcudf
84-
set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
84+
set(CUDA_USE_STATIC_CUDA_RUNTIME ON)
8585

8686
rapids_cpm_init()
8787
rapids_cpm_find(cudf 23.12.00
@@ -94,7 +94,7 @@ rapids_cpm_find(cudf 23.12.00
9494
"BUILD_BENCHMARKS OFF"
9595
"CUDF_USE_ARROW_STATIC ON"
9696
"JITIFY_USE_CACHE ON"
97-
"CUDA_STATIC_RUNTIME OFF"
97+
"CUDA_STATIC_RUNTIME ${CUDA_USE_STATIC_CUDA_RUNTIME}"
9898
"DISABLE_DEPRECATION_WARNING ON"
9999
"AUTO_DETECT_CUDA_ARCHITECTURES OFF"
100100
)

0 commit comments

Comments
 (0)