SWDEV-222423 - Add HIP Sample 2_Cookbook/15_static_library

HIP supports emitting two types of static libraries. One type
will export host functions and is compatible with host linkers.
The second type exports device functions, but is generated with
ar manually. Also, add a README with steps on how to run these
samples with Makefile or CMake.

Change-Id: I1be15c2884583b370092bc8e4bf04f726f8f5a27
이 커밋은 다음에 포함됨:
Aaron En Ye Shi 작성하고 Aaron En Ye Shi가 2021-04-27 16:05:15 -04:00를 커밋함
1 부모 cf02c80e13
커밋 458a09f151
9 파일이 변경됨
+506

검색과 일치하는 파일 없음

+28
파일 보기
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2020-present Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
* */
#include <hip/hip_runtime.h>
__device__ int square_me(int A) {
return A*A;
}