change SAFT

This commit is contained in:
kradchen
2023-06-09 11:19:30 +08:00
parent 03a79b9357
commit 63bae1683f
10 changed files with 511 additions and 519 deletions

View File

@@ -2,11 +2,9 @@ cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(SaftATT)
set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc)
enable_language(CUDA)
set(Matlab_ROOT_DIR /usr/local/Polyspace/R2019b)
find_package(Matlab)
add_library(SaftATT SHARED ./src/SAFT_ATT.cpp ./src/saft.cu ./src/processAScans.cpp ./src/saft.cpp )
target_include_directories(SaftATT PRIVATE ./src /usr/local/cuda/include /usr/local/Polyspace/R2019b/extern/include)
target_include_directories(SaftATT PRIVATE ./src /usr/local/cuda/include )
set_target_properties(SaftATT PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_compile_options(SaftATT PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
# -O3
@@ -16,5 +14,5 @@ target_compile_options(SaftATT PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:
-arch compute_30 -code compute_30,sm_30
>)
target_link_libraries(SaftATT PRIVATE ${CUDA_RUNTIME_LIBRARY} ${Matlab_MEX_LIBRARY} ${Matlab_MX_LIBRARY})
target_link_libraries(SaftATT PRIVATE ${CUDA_RUNTIME_LIBRARY} )
set_target_properties(SaftATT PROPERTIES PUBLIC_HEADER ${CMAKE_CURRENT_LIST_DIR}/src/SAFT_ATT.h)

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,12 @@
#ifndef __SAFT_ATT_H__
#define __SAFT_ATT_H__
#include <mex.h>
extern "C"{
void SAFT_ATT(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
}
#include <cstddef>
#include <vector>
struct Matrix_a{
void* Data;
size_t NumberOfDims;
size_t Dims[3];
size_t DataSize;
};
extern Matrix_a SAFT_ATT(std::vector<Matrix_a>& params);
#endif // __SAFT_ATT_H__

View File

@@ -1,4 +1,3 @@
#include <mex.h>
#include <math.h>
#include <stdio.h>
@@ -1442,7 +1441,7 @@ void SAFTHandler::processAScans(
}
#endif
if (zBlockCount == 0) {
mexErrMsgTxt("(zBlockCount == 0) && (windowGridDimensions > 65536) => try higher genericSAFTBlockDimensions if possible or lower XY-Resolution");
printf("(zBlockCount == 0) && (windowGridDimensions > 65536) => try higher genericSAFTBlockDimensions if possible or lower XY-Resolution");
}
zLayerCount = ((zBlockCount * genericSAFTBlockDimensions.z) < (zLayerCount)) ? (zBlockCount * genericSAFTBlockDimensions.z) : (zLayerCount);

View File

@@ -1,4 +1,4 @@
#include <mex.h>
#include <iostream>
#include <vector>
@@ -318,7 +318,7 @@ void SAFTHandler::performReconstruction()
// if(batchSize > aScanCount) // Abfrage macht keinen Sinn mehr wenn batchSize = aScanCount;
// {
// mexErrMsgTxt("A-scan window size cannot be larger than the total number of A-scans");
// printf("A-scan window size cannot be larger than the total number of A-scans");
// //throw ail::exception("A-scan window size cannot be larger than the total number of A-scans");
// }
@@ -541,12 +541,12 @@ void SAFTHandler::partialReconstructionInitialisation()
//
// partialOutputVoxelCount = partialOutputSize / sizeof(double);
//// if(partialOutputVoxelCount % zLayerVoxelCount != 0) //Sicherheitsabfrage nun im kernel
//// mexErrMsgTxt("The partial output size must consist of a discrete number of z-layers for the chosen resolution");
//// printf("The partial output size must consist of a discrete number of z-layers for the chosen resolution");
// //throw ail::exception("The partial output size must consist of a discrete number of z-layers for the chosen resolution");
// partialOutputZLayerCount = partialOutputVoxelCount / zLayerVoxelCount;
//
//// if(partialOutputZLayerCount % genericSAFTBlockDimensions.z != 0) //Sicherheitsabfrage nun im kernel
//// mexErrMsgTxt("The number of Z-layers in the output window must be a multiple of the reconstruction block dimensions");
//// printf("The number of Z-layers in the output window must be a multiple of the reconstruction block dimensions");
// //throw ail::exception("The number of Z-layers in the output window must be a multiple of the reconstruction block dimensions");
//
// //Make dynamically sized allocations for the pre-calculated speed of sound data.
@@ -644,7 +644,7 @@ void performCUDAResultCheck(
//std::string errorMessage = "A CUDA operation failed in file \"" + file + "\" (line " + ail::number_to_string(line) + "): " + std::string(cudaGetErrorString(result));
//std::cout << errorMessage << std::endl;
mexErrMsgTxt("-> Error occurred");
printf("-> Error occurred");
}
}