Skip to content

Commit bd26f89

Browse files
author
feiy
committed
Updating document for JAVA
1 parent 6b40fc0 commit bd26f89

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/QuickStartGuide_java.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,29 @@ float[] hvec = (float[]) dvec.to_host();
353353

354354
There are optional parameters *begin* and *end* which can be used to specify a range to copy.
355355

356+
### DVVectorAdaptor
357+
358+
DVVectorAdaptor objects are device Vectors with externally managed storage.
359+
360+
In C++ code, user can create a DVVectorAdaptor object just like creating a DVVector,
361+
passing in pointer of device memory instead of host memory to initialize the object.
362+
The device memory should not be freed while the DVVectorAdaptor object is still being
363+
used.
364+
365+
Alternatively, user can create a DVVectorAdaptor object using an existing DVVector or
366+
DVVectorAdaptor object and a range specified by a *begin/end* pair.
367+
368+
```cpp
369+
// C++
370+
float hvalues[8] = { 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f };
371+
DVVector dvalues("float", 8, hvalues);
372+
DVVectorAdaptor drange(dvvalue, 2, 5);
373+
// drange maps to { 30.0f, 40.0f, 50.0f }
374+
```
375+
376+
In JAVA, DVVectorAdaptor can be used similarly.
377+
An native pointer expressed by a "long" value from an external library can be used to initialize a DVVectorAdaptor object.
378+
356379
### DVRange
357380
358381
DVRange objects can be used to map to a range of an abitary Vector object.

0 commit comments

Comments
 (0)