Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #17

Merged
merged 65 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
4aec143
FIX: fixing center pixel when gridding and degridding
miguelcarcamov Apr 17, 2024
a8ef0fc
FIX: fix phase rotation to use 2*pi(ux+vy)
miguelcarcamov Apr 26, 2024
e81c975
Merge branch 'development' of github.com:miguelcarcamov/gpuvmem into …
miguelcarcamov May 9, 2024
858ef4e
FIX: fixing briggs and uniform weighting
miguelcarcamov May 9, 2024
daee82a
FIX: fixing briggs and uniform weighting
miguelcarcamov May 9, 2024
d0c3053
CHG: fixing idft signs
miguelcarcamov Jun 7, 2024
1878fce
CHG: fixing sign of the FFT2D
miguelcarcamov Jun 7, 2024
b7150ff
CHG: fixing sign of dft - there is a bug
miguelcarcamov Jun 7, 2024
c87b620
CHG: adding code in CMakeLists.txt to find cuda architecture
miguelcarcamov Jun 7, 2024
a1e0448
CHG: working code, need to update cuda samples folder
miguelcarcamov Jun 7, 2024
8adeea2
FIX: Dockerfile
miguelcarcamov Jun 9, 2024
89c978c
FIX: Dockerfile
miguelcarcamov Jun 9, 2024
38c34e7
CHG: updating requirements and environments
miguelcarcamov Jun 10, 2024
8c1c3f2
CHG: updating requirements and environments
miguelcarcamov Jun 10, 2024
a17dd54
CHG: adding mkdir command in Dockerfile.prof to store casadata files
miguelcarcamov Jun 10, 2024
35e8f97
CHG: rolling back to old vis_mod function
miguelcarcamov Jun 12, 2024
6c10d0b
CHG: rolling back to old vis_mod function
miguelcarcamov Jun 12, 2024
f098e0b
FIX: testing changes in phase_rotate
miguelcarcamov Jun 13, 2024
0c1d62c
FIX: testing changes in phase_rotate
miguelcarcamov Jun 13, 2024
d215852
FIX: fixing modelToHost in MSFITSIO
miguelcarcamov Jun 14, 2024
6e38008
FIX: fixing vis_mod functions.cu
miguelcarcamov Jun 14, 2024
3c0268e
FIX: small fix in do_gridding
miguelcarcamov Jun 14, 2024
f91b086
FIX: small fix in vis_mod
miguelcarcamov Jun 14, 2024
87e0d40
FIX: small fix in do_gridding
miguelcarcamov Jun 14, 2024
421add8
FIX: small fix in do_gridding
miguelcarcamov Jun 14, 2024
f69308d
FIX: small fix in do_gridding
miguelcarcamov Jun 14, 2024
1431baf
FIX: fixing chi2 and simulate when using CKernel
miguelcarcamov Jun 14, 2024
83aaa2f
FIX: fixing chi2 and simulate when using CKernel
miguelcarcamov Jun 14, 2024
ca7757a
FIX: fixing chi2 and simulate when using CKernel
miguelcarcamov Jun 14, 2024
06d4a03
FIX: test do_gridding
miguelcarcamov Jun 14, 2024
a4f04ce
FIX: rollback
miguelcarcamov Jun 14, 2024
b111ec9
FIX: various fixes in functions.cu
miguelcarcamov Jun 14, 2024
fba069f
FIX: fixing do_gridding and now gridding the whole grid. Not using he…
miguelcarcamov Jun 16, 2024
393116d
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
cb86665
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
fba69a6
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
6f77ee8
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
92fb85d
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
a17c59e
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
70a14e4
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
605cea2
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
45ee8c5
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
333ebbc
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
0f564dc
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
53fd588
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
e423fa5
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
b79f5eb
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
f8e2967
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
f50198c
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
a022017
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
44651b0
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
b302626
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
a930bad
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
394ed4d
CHG: updating reading queries
miguelcarcamov Jun 18, 2024
b84b76c
FIX: updating queries
miguelcarcamov Jun 19, 2024
2d1e838
CHG: updating workflows
miguelcarcamov Jun 24, 2024
ece8737
CHG: subtracting vo-vm instead of vm-vo. This implies that a minus si…
miguelcarcamov Jul 22, 2024
c13a5c7
CHG: deleting fg_scale and using units
miguelcarcamov Jul 30, 2024
c5488c7
FIX: fixing gridding and adding normalization variable
miguelcarcamov Oct 30, 2024
c55f3bb
FIX: adding fg_scale to chi2
miguelcarcamov Nov 4, 2024
2f15c3d
FIX: adding fg_scale and using it when not using normalization
miguelcarcamov Nov 5, 2024
c62d9d9
FIX: fix cmakelists
miguelcarcamov Nov 5, 2024
4ea7248
FIX: fix Dockerfile.prof
miguelcarcamov Nov 5, 2024
058c237
FIX: updating yml workflow files
miguelcarcamov Nov 5, 2024
7d453e8
FIX: adding permissions to workflows
miguelcarcamov Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/build_base_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ env:
jobs:
build-base-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand All @@ -24,11 +27,11 @@ jobs:
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: true # Will only build if this is not here
tags: ${{ env.REGISTRY }}/${{ github.repository }}:base
7 changes: 5 additions & 2 deletions .github/workflows/build_latest_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ env:
jobs:
build-latest-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
Expand All @@ -28,9 +31,9 @@ jobs:
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
file: ./Dockerfile.prod
push: true # Will only build if this is not here
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/build_tagged_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ env:
jobs:
build-tagged-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Get tag
id: tag
Expand All @@ -24,9 +27,9 @@ jobs:
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
file: ./Dockerfile.prod
push: true # Will only build if this is not here
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.9.0
rev: v2.14.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
Expand All @@ -33,7 +33,7 @@ repos:
- id: beautysh

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.34.0
rev: v0.42.0
hooks:
- id: markdownlint-fix
entry: markdownlint -f README.md --disable MD013 MD036 MD033 MD046
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ if(Boost_FOUND)
set(TEMP "${TEMP} ") # A space to cleanly separate from existing content
endif()

# Find CUDA architecture
include(FindCUDA/select_compute_arch)
cuda_detect_installed_gpus(INSTALLED_GPU_CCS_1)
string(STRIP "${INSTALLED_GPU_CCS_1}" INSTALLED_GPU_CCS_2)
string(REPLACE " " ";" INSTALLED_GPU_CCS_3 "${INSTALLED_GPU_CCS_2}")
string(REPLACE "." "" INSTALLED_GPU_CCS_4 "${INSTALLED_GPU_CCS_3}")
string(REPLACE "+PTX" "" CUDA_ARCH_LIST "${INSTALLED_GPU_CCS_4}")
set(CMAKE_CUDA_ARCHITECTURES ${CUDA_ARCH_LIST})
set_target_properties(gpuvmem PROPERTIES CUDA_ARCHITECTURES
"${CUDA_ARCH_LIST}")

message(STATUS "CUDA Architecture: ${CMAKE_CUDA_ARCHITECTURES}")
message(STATUS "CUDA Version: ${CUDAToolkit_VERSION}")
message(STATUS "CUDA Path: ${CUDAToolkit_LIBRARY_ROOT}")
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RUN git clone --single-branch --branch v3.5.0 https://github.com/casacore/casaco

# Install CUDA samples
RUN cd /usr/local/cuda && \
git clone --single-branch --branch v11.6 https://github.com/NVIDIA/cuda-samples.git samples && \
git clone --single-branch --branch v12.4 https://github.com/NVIDIA/cuda-samples.git samples && \
cd samples && \
mv Common common && \
mv Samples samples && \
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.prod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN cd gpuvmem && \
cd $BUILD_DIR && \
cmake --build . --target install --verbose -j `nproc` && \
cd .. && \
pip3 install -r requirements.txt
pip3 install -r requirements.txt && \
mkdir -p $HOME/.casa/data
RUN echo "Hello there! from GPUVMEM production image"
LABEL org.opencontainers.image.source="https://github.com/miguelcarcamov/gpuvmem"
23 changes: 11 additions & 12 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ dependencies:
- numpy=1.24
- pip
- pip:
- casadata==2023.9.18
- casafeather==0.0.20
- casalogger==1.0.17
- casampi==0.5.4
- casaplotms==2.2.4
- casaplotserver==1.7.1
- casashell==6.6.0.20
- casatablebrowser==0.0.33
- casatasks==6.6.0.20
- casatestutils==6.6.0.20
- casatools==6.6.0.20
- casaviewer==1.9.1
- casatools==6.6.4.34
- casatasks==6.6.4.34
- casaplotms==2.4.3
- casaviewer==2.1.4
- casashell==6.6.4.34
- casaplotserver==1.8.2
- casatestutils==6.6.4.34
- casatablebrowser==0.0.35
- casalogger==1.0.19
- casafeather==0.0.22
- casampi==0.5.5
23 changes: 11 additions & 12 deletions environment_cudatoolkit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ dependencies:
- numpy=1.24
- pip
- pip:
- casadata==2023.9.18
- casafeather==0.0.20
- casalogger==1.0.17
- casampi==0.5.4
- casaplotms==2.2.4
- casaplotserver==1.7.1
- casashell==6.6.0.20
- casatablebrowser==0.0.33
- casatasks==6.6.0.20
- casatestutils==6.6.0.20
- casatools==6.6.0.20
- casaviewer==1.9.1
- casatools==6.6.4.34
- casatasks==6.6.4.34
- casaplotms==2.4.3
- casaviewer==2.1.4
- casashell==6.6.4.34
- casaplotserver==1.8.2
- casatestutils==6.6.4.34
- casatablebrowser==0.0.35
- casalogger==1.0.19
- casafeather==0.0.22
- casampi==0.5.5
6 changes: 4 additions & 2 deletions include/MSFITSIO.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ typedef struct field {
int valid_frequencies;
double ref_ra, ref_dec;
double phs_ra, phs_dec;
float ref_xobs, ref_yobs;
float phs_xobs, phs_yobs;
float ref_xobs_cartesian, ref_yobs_cartesian;
float phs_xobs_cartesian, phs_yobs_cartesian;
float ref_xobs_pix, ref_yobs_pix;
float phs_xobs_pix, phs_yobs_pix;
float* atten_image;
std::vector<float> nu;
std::vector<std::vector<long>> numVisibilitiesPerFreqPerStoke;
Expand Down
12 changes: 9 additions & 3 deletions include/chi2.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ class Chi2 : public Fi {
void calcGi(float* p, float* xi);
void restartDGi();
void addToDphi(float* device_dphi);
void configure(int penalizatorIndex, int imageIndex, int imageToAdd) override;
void setPenalizationFactorFromInputIndex(int index){};
float calculateSecondDerivate(){};
void configure(int penalizatorIndex,
int imageIndex,
int imageToAdd,
bool normalize) override;
void setPenalizationFactorFromInputIndex(int index) {};
float calculateSecondDerivate() {};
void setCKernel(CKernel* ckernel) override;
void setFgScale(float fg_scale) override;
float getFgScale() override;

private:
VirtualImageProcessor* ip;
float fg_scale = 1.0;
int imageToAdd;
float* result_dchi2;
};
Expand Down
23 changes: 16 additions & 7 deletions include/classes/fi.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,27 @@ class Fi {
this->penalization_factor = 1.0f;
this->Inu = NULL;
this->iteration = 0;
this->normalize = false;
}

virtual float calcFi(float* p) = 0;
virtual void calcGi(float* p, float* xi) = 0;
virtual void restartDGi() = 0;
virtual void addToDphi(float* device_dphi) = 0;
virtual void setPrior(float prior){};
virtual void setPrior(float* prior){};
virtual float getEta(){};
virtual void setEta(float eta){};
virtual void setCKernel(CKernel* ckernel){};
virtual void setPrior(float prior) {};
virtual void setPrior(float* prior) {};
virtual float getEta() {};
virtual void setEta(float eta) {};
virtual void setCKernel(CKernel* ckernel) {};
virtual void setFgScale(float fg_scale) {};
virtual float getFgScale() {};

std::string getName() { return this->name; };

std::string setName(std::string name) { this->name = name; };

float get_fivalue() { return this->fi_value; };
bool getNormalize() { return this->normalize; };
float getPenalizationFactor() { return this->penalization_factor; };
void set_fivalue(float fi) { this->fi_value = fi; };
void setPenalizationFactor(float p) { this->penalization_factor = p; };
Expand All @@ -48,13 +52,18 @@ class Fi {
this->device_DS = DS;
};
void setIteration(int iteration) { this->iteration = iteration; };
void setNormalize(bool normalize) { this->normalize = normalize; };

virtual float calculateSecondDerivate() = 0;
virtual void configure(int penalizatorIndex, int imageIndex, int imageToAdd) {
virtual void configure(int penalizatorIndex,
int imageIndex,
int imageToAdd,
bool normalize) {
this->imageIndex = imageIndex;
this->order = order;
this->mod = mod;
this->imageToAdd = imageToAdd;
this->normalize = normalize;

if (imageIndex > image_count - 1 || imageToAdd > image_count - 1) {
printf("There is no image for the provided index %s\n", this->name);
Expand Down Expand Up @@ -89,9 +98,9 @@ class Fi {
int mod;
int order;
std::string name;
;
cufftComplex* Inu;
int imageToAdd;
bool normalize;
};

#endif
5 changes: 5 additions & 0 deletions include/classes/synthesizer.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ class Synthesizer {

__host__ void setVisNoise(float noise) { this->vis_noise = noise; };

__host__ float getFgScale() { return this->fg_scale; };

__host__ void setFgScale(float fg_scale) { this->fg_scale = fg_scale; };

protected:
cufftComplex* device_I;
Image* image;
Expand All @@ -81,6 +85,7 @@ class Synthesizer {
Error* error = NULL;
int griddingThreads = 0;
bool gridding = false;
float fg_scale = 1.0;
float vis_noise = 0.0;
void (*Order)(Optimizer* o, Image* I) = NULL;
int imagesChanged = 0;
Expand Down
5 changes: 3 additions & 2 deletions include/classes/virtualimageprocessor.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ class VirtualImageProcessor {
float xobs,
float yobs,
float freq,
int primary_beam) = 0;
int primary_beam,
float fg_scale) = 0;
virtual void calculateInu(cufftComplex* image, float* I, float freq) = 0;
virtual void chainRule(float* I, float freq) = 0;
virtual void chainRule(float* I, float freq, float fg_scale) = 0;
virtual void configure(int i) = 0;
virtual CKernel* getCKernel() { return this->ckernel; };
virtual void setCKernel(CKernel* ckernel) { this->ckernel = ckernel; };
Expand Down
20 changes: 14 additions & 6 deletions include/functions.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,18 @@ __host__ T deviceReduce(T* in, long N, int input_threads);
__host__ float deviceMaxReduce(float* in, long N, int input_threads);
__host__ float deviceMinReduce(float* in, long N, int input_threads);
__host__ float simulate(float* I, VirtualImageProcessor* ip);
__host__ float chi2(float* I, VirtualImageProcessor* ip);
__host__ float chi2(float* I,
VirtualImageProcessor* ip,
bool normalize,
float fg_scale);
__host__ void linkRestartDGi(float* dgi);
__host__ void linkAddToDPhi(float* dphi, float* dgi, int index);
__host__ void dchi2(float* I,
float* dxi2,
float* result_dchi2,
VirtualImageProcessor* ip);
VirtualImageProcessor* ip,
bool normalize,
float fg_scale);
__host__ void defaultNewP(float* p, float* xi, float xmin, int image);
__host__ void particularNewP(float* p, float* xi, float xmin, int image);
__host__ void defaultEvaluateXt(float* xt,
Expand All @@ -171,10 +176,11 @@ __host__ void linkApplyBeam2I(cufftComplex* image,
float xobs,
float yobs,
float freq,
int primary_beam);
int primary_beam,
float fg_scale);
__host__ void linkClipWNoise2I(float* I);
__host__ void linkCalculateInu2I(cufftComplex* image, float* I, float freq);
__host__ void linkChain2I(float* chain, float freq, float* I);
__host__ void linkChain2I(float* chain, float freq, float* I, float fg_scale);
__host__ void normalizeImage(float* image, float normalization_factor);
__host__ void linkClip(float* I);
__host__ void DEntropy(float* I,
Expand Down Expand Up @@ -485,7 +491,8 @@ __global__ void DChi2(float* noise,
float pb_factor,
float pb_cutoff,
float freq,
int primary_beam);
int primary_beam,
bool normalize);
__global__ void DChi2(float* noise,
float* gcf,
float* dChi2,
Expand All @@ -506,7 +513,8 @@ __global__ void DChi2(float* noise,
float pb_factor,
float pb_cutoff,
float freq,
int primary_beam);
int primary_beam,
bool normalize);
__global__ void projection(float* px, float* x, float MINPIX, long N);
__global__ void substraction(float* x,
cufftComplex* xc,
Expand Down
5 changes: 3 additions & 2 deletions include/imageProcessor.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ class ImageProcessor : public VirtualImageProcessor {
float xobs,
float yobs,
float freq,
int primary_beam);
int primary_beam,
float fg_scale);
void calculateInu(cufftComplex* image, float* I, float freq);
void chainRule(float* I, float freq);
void chainRule(float* I, float freq, float fg_scale);
void configure(int i);
};

Expand Down
Loading
Loading