mirror of
				https://github.com/NVIDIA/cuda-samples.git
				synced 2025-11-04 07:27:49 +08:00 
			
		
		
		
	Merge pull request #22 from XSShawnZeng/master
Update source code for cudaGraphPerfScaling and remove dupe target in cuda-c-linking CMakeLists.txt
This commit is contained in:
		
						commit
						dcce6e1f14
					
				@ -350,8 +350,10 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
    cudaFree(0);
 | 
			
		||||
    cudaMallocHost(&hostData, sizeof(*hostData));
 | 
			
		||||
    stream.resize(width);
 | 
			
		||||
    for (int i = 0; i < width; i++)
 | 
			
		||||
    int numStreams = width;
 | 
			
		||||
    if (numStreams == 1) numStreams = 2; // demo needs two streams even if capture only needs 1.
 | 
			
		||||
    stream.resize(numStreams);
 | 
			
		||||
    for (int i = 0; i < numStreams; i++)
 | 
			
		||||
    {
 | 
			
		||||
        cudaStreamCreate(&stream[i]);
 | 
			
		||||
    }
 | 
			
		||||
@ -386,7 +388,7 @@ int main(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
    if (!(outputFmt & 6)) {
 | 
			
		||||
        printf("skipping trials since no output is expected\n");
 | 
			
		||||
        return EXIT_FAILURE;
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    std::vector<double> metricTotal;
 | 
			
		||||
@ -429,6 +431,9 @@ int main(int argc, char **argv)
 | 
			
		||||
        length += stride;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    printf("\n");
 | 
			
		||||
}
 | 
			
		||||
    cudaFreeHost(hostData);
 | 
			
		||||
 | 
			
		||||
    printf("\n");
 | 
			
		||||
    printf("Test passed\n");
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -34,8 +34,7 @@ if (LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL "15" OR
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
add_executable(cuda-c-linking cuda-c-linking.cpp)
 | 
			
		||||
add_custom_target(clobber)
 | 
			
		||||
add_custom_target(testrun)
 | 
			
		||||
 | 
			
		||||
add_test(NAME cuda-c-linking
 | 
			
		||||
   COMMAND cuda-c-linking
 | 
			
		||||
   WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
 | 
			
		||||
@ -82,3 +81,12 @@ set_target_properties(mathfuncs64 PROPERTIES PREFIX "lib"
 | 
			
		||||
                      OUTPUT_NAME "mathfuncs64"
 | 
			
		||||
                      SUFFIX ".a" CUDA_SEPERABLE_COMPILATION ON)
 | 
			
		||||
install(TARGETS cuda-c-linking mathfuncs64 DESTINATION bin)
 | 
			
		||||
 | 
			
		||||
if (WIN32)
 | 
			
		||||
  add_custom_command(
 | 
			
		||||
      TARGET cuda-c-linking
 | 
			
		||||
      POST_BUILD
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E copy_if_different
 | 
			
		||||
              "${CMAKE_BINARY_DIR}/nvvm64_40_0.dll" "$<TARGET_FILE_DIR:cuda-c-linking>"
 | 
			
		||||
  )
 | 
			
		||||
endif ()
 | 
			
		||||
@ -53,10 +53,10 @@ add_custom_command(
 | 
			
		||||
            "${CMAKE_CURRENT_SOURCE_DIR}/dsl-gpu64.ll" "$<TARGET_FILE_DIR:dsl>"
 | 
			
		||||
)
 | 
			
		||||
if (WIN32)
 | 
			
		||||
add_custom_command(
 | 
			
		||||
    TARGET dsl
 | 
			
		||||
    POST_BUILD
 | 
			
		||||
    COMMAND ${CMAKE_COMMAND} -E copy_if_different
 | 
			
		||||
            "${CMAKE_BINARY_DIR}/nvvm64_40_0.dll" "$<TARGET_FILE_DIR:dsl>"
 | 
			
		||||
)
 | 
			
		||||
  add_custom_command(
 | 
			
		||||
      TARGET dsl
 | 
			
		||||
      POST_BUILD
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E copy_if_different
 | 
			
		||||
              "${CMAKE_BINARY_DIR}/nvvm64_40_0.dll" "$<TARGET_FILE_DIR:dsl>"
 | 
			
		||||
  )
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
@ -51,10 +51,10 @@ add_custom_command(
 | 
			
		||||
            "${CMAKE_CURRENT_SOURCE_DIR}/test.ll" "$<TARGET_FILE_DIR:ptxgen>"
 | 
			
		||||
)
 | 
			
		||||
if (WIN32)
 | 
			
		||||
add_custom_command(
 | 
			
		||||
    TARGET ptxgen
 | 
			
		||||
    POST_BUILD
 | 
			
		||||
    COMMAND ${CMAKE_COMMAND} -E copy_if_different
 | 
			
		||||
            "${CMAKE_BINARY_DIR}/nvvm64_40_0.dll" "$<TARGET_FILE_DIR:ptxgen>"
 | 
			
		||||
)
 | 
			
		||||
  add_custom_command(
 | 
			
		||||
      TARGET ptxgen
 | 
			
		||||
      POST_BUILD
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E copy_if_different
 | 
			
		||||
              "${CMAKE_BINARY_DIR}/nvvm64_40_0.dll" "$<TARGET_FILE_DIR:ptxgen>"
 | 
			
		||||
  )
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
@ -52,10 +52,10 @@ add_custom_command(
 | 
			
		||||
            "${CMAKE_CURRENT_SOURCE_DIR}/simple-gpu64.ll" "$<TARGET_FILE_DIR:simple>"
 | 
			
		||||
)
 | 
			
		||||
if (WIN32)
 | 
			
		||||
add_custom_command(
 | 
			
		||||
    TARGET simple
 | 
			
		||||
    POST_BUILD
 | 
			
		||||
    COMMAND ${CMAKE_COMMAND} -E copy_if_different
 | 
			
		||||
            "${CMAKE_BINARY_DIR}/nvvm64_40_0.dll" "$<TARGET_FILE_DIR:simple>"
 | 
			
		||||
)
 | 
			
		||||
  add_custom_command(
 | 
			
		||||
      TARGET simple
 | 
			
		||||
      POST_BUILD
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E copy_if_different
 | 
			
		||||
              "${CMAKE_BINARY_DIR}/nvvm64_40_0.dll" "$<TARGET_FILE_DIR:simple>"
 | 
			
		||||
  )
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
@ -56,10 +56,10 @@ add_custom_command(
 | 
			
		||||
            "${CMAKE_CURRENT_SOURCE_DIR}/uvmlite64.ll" "$<TARGET_FILE_DIR:uvmlite>"
 | 
			
		||||
)
 | 
			
		||||
if (WIN32)
 | 
			
		||||
add_custom_command(
 | 
			
		||||
    TARGET uvmlite
 | 
			
		||||
    POST_BUILD
 | 
			
		||||
    COMMAND ${CMAKE_COMMAND} -E copy_if_different
 | 
			
		||||
            "${CMAKE_BINARY_DIR}/nvvm64_40_0.dll" "$<TARGET_FILE_DIR:uvmlite>"
 | 
			
		||||
)
 | 
			
		||||
  add_custom_command(
 | 
			
		||||
      TARGET uvmlite
 | 
			
		||||
      POST_BUILD
 | 
			
		||||
      COMMAND ${CMAKE_COMMAND} -E copy_if_different
 | 
			
		||||
              "${CMAKE_BINARY_DIR}/nvvm64_40_0.dll" "$<TARGET_FILE_DIR:uvmlite>"
 | 
			
		||||
  )
 | 
			
		||||
endif ()
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user