sccn / amica

Code for AMICA: Adaptive Mixture ICA with shared components
BSD 2-Clause "Simplified" License
23 stars 13 forks source link

Fixing random seed #32

Closed skostrichegg closed 2 years ago

skostrichegg commented 2 years ago

Hi,

I opened the issue about random seed before. (https://github.com/japalmer29/amica/issues/29#issue-980975234)

And as you recommended, I could get the constant results after setting 'fix_init = 1'. But the components look like not extracted well, so I tried to find the another way to get stable results.

At first, I compiled amica with GNU fortran after fixing random_seed to 1. (build command is as bellow.)

amica15.f90

! call random_seed(PUT = c1 * (myrank+1) * (seed+myrank+1))
call random_seed(size=seed_size)
allocate(seed(seed_size))
seed = 1
call random_seed(put=seed)

When I run the customized amica with 'block_size=1024', I can check the stable results(but not constant perfectly) and also components are extracted well.

But I worry about some potential side effect of above solution. So If you don't mind, l would like to ask you review this and let me know the risks you think if exists.

Best regards,

japalmer29 commented 2 years ago

Hi, Glad you could solve the issue by modifying the code. One thing, in fortran90, if you put 1 instead of 1.0 for a float, it may actually be using some weird value instead of 1 as intended, depending on the compiler. Also, you might try the Intel OneAPI compiler which should be free and multiplatform, for best performance (see the readme description on the github site). Best, Jason

On Thu, Jan 27, 2022, 11:01 AM skostrichegg @.***> wrote:

Hi,

I opened the issue about random seed before. (#29 (comment) https://github.com/japalmer29/amica/issues/29#issue-980975234)

And as you recommended, I could get the constant results after setting 'fix_init = 1'. But the components look like not extracted well, so I tried to find the another way to get stable results.

At first, I compiled amica with GNU fortran after fixing random_seed to 1. (build command is as bellow.)

  • On Debian GNU/Linux 11 (bullseye) with Intel chipset $ mpif90 -o amica15ub funmod2.f90 amica15.f90 libblas.a liblapack.a -L/usr/local/lib -I/usr/local/include -cpp -O3 -fopenmp -Xpreprocessor -ffree-line-length-512 -static -lblas -llapack

amica15.f90

! call random_seed(PUT = c1 (myrank+1) (seed+myrank+1)) call random_seed(size=seed_size) allocate(seed(seed_size)) seed = 1 call random_seed(put=seed)

When I run the customized amica with 'block_size=1024', I can check the stable results(but not constant perfectly) and also components are extracted well.

But I worry about some potential side effect of above solution. So If you don't mind, l would like to ask you review this and let me know the risks you think if exists.

Best regards,

— Reply to this email directly, view it on GitHub https://github.com/japalmer29/amica/issues/32, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRBESVCDDE5DVWWNIPSTBTUYCRPHANCNFSM5M4TU3FQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

japalmer29 commented 2 years ago

Oh sorry, I guess the random_seed put argument is integer. So it should be ok.

Jason

On Sun, Jan 30, 2022, 8:43 AM Jason Palmer @.***> wrote:

Hi, Glad you could solve the issue by modifying the code. One thing, in fortran90, if you put 1 instead of 1.0 for a float, it may actually be using some weird value instead of 1 as intended, depending on the compiler. Also, you might try the Intel OneAPI compiler which should be free and multiplatform, for best performance (see the readme description on the github site). Best, Jason

On Thu, Jan 27, 2022, 11:01 AM skostrichegg @.***> wrote:

Hi,

I opened the issue about random seed before. (#29 (comment) https://github.com/japalmer29/amica/issues/29#issue-980975234)

And as you recommended, I could get the constant results after setting 'fix_init = 1'. But the components look like not extracted well, so I tried to find the another way to get stable results.

At first, I compiled amica with GNU fortran after fixing random_seed to

  1. (build command is as bellow.)

    • On Debian GNU/Linux 11 (bullseye) with Intel chipset $ mpif90 -o amica15ub funmod2.f90 amica15.f90 libblas.a liblapack.a -L/usr/local/lib -I/usr/local/include -cpp -O3 -fopenmp -Xpreprocessor -ffree-line-length-512 -static -lblas -llapack

amica15.f90

! call random_seed(PUT = c1 (myrank+1) (seed+myrank+1)) call random_seed(size=seed_size) allocate(seed(seed_size)) seed = 1 call random_seed(put=seed)

When I run the customized amica with 'block_size=1024', I can check the stable results(but not constant perfectly) and also components are extracted well.

But I worry about some potential side effect of above solution. So If you don't mind, l would like to ask you review this and let me know the risks you think if exists.

Best regards,

— Reply to this email directly, view it on GitHub https://github.com/japalmer29/amica/issues/32, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRBESVCDDE5DVWWNIPSTBTUYCRPHANCNFSM5M4TU3FQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

skostrichegg commented 2 years ago

Hi, As your suggestion, I compiled amICA by Intel OneAPI compiler and could get constant results. Thank you for your support.